Hi, I am completely new to matlab.
Please guide me how can I find center to contour angle (in degree) for each contour pixel?
Suppose I have an input image like bell-12.gif. Now, I know the centeroid of it. Say suppose[110,99]. I also know the boundary pixel array of bell-12.gif. Now I want to calculate the angle between centroid to each boundary pixel and store it into an array Angle. How can I find the Angle array?
I tried the following code by fixing one angle:
x = [cents1(1) cents1(2)]; % common point
y = [boundary(1,1),boundary(1,2)];
a = [cents1(1) cents1(2)]; % common point
b = [boundary(i,1) boundary(i,2)];
CCDANG(i)=(atan((y(2)-x(2))/(y(1)-x(1))) - atan((b(2)-a(2))/(b(1)-a(1)))) * 180/pi;
This gives me negative value for angle. I am not sure what exactly is the way to solve it.