how to build an accumulator array in matlab
- by schwiz
I'm very new to matlab so sorry if this is a dumb question. I have to following matrices:
im = imread('image.jpg'); %<370x366 double>
[y,x] = find(im); %x & y both <1280x1 double>
theta; %<370x366 double> computed from gradient of image
I can currently plot points one at a time like this:
plot(x(502) + 120*cos(theta(y(502),x(502))),y(502) + 120*sin(theta(y(502),x(502))),'*b');
But what I want to do is some how increment an accumulator array, something like this:
acc = zeros(size(im));
acc(y,x) = acc(x + 120*cos(theta(y,x)),y + 120*sin(theta(y,x)),'*b')) + 1;
It would be nice if the 120 could actually be another matrix containing different radius values as well.