how to build an accumulator array in matlab
Posted
by
schwiz
on Stack Overflow
See other posts from Stack Overflow
or by schwiz
Published on 2012-12-02T17:01:44Z
Indexed on
2012/12/02
17:03 UTC
Read the original article
Hit count: 462
matlab
|multidimensional-array
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.
© Stack Overflow or respective owner