I am trying to implement the generalized Hough transform in matlab. The algorithm requires the gradient direction at each point in the shape. How can I measure phi as shown in the figure below?
The normal to the curve [x(t), y(t)] is [-dy(t)/dt, dx(t)/dt]. Thus, with x
being the x-coordinates and y
the y-coordinates, the normals are
[-diff(y(:)),diff(x(:))]
and the angle phi is
atan2(diff(x(:)),-diff(y(:)))