Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I didn't debug your program, but it has a clear flaw: you are using absolute values of gradients to compute the gradient direction instead of the gradients themselves!

Note that for a gradient gx=1 gy=0 the orientation is 0, but if gx=-1 the orientation is PI/2 (even if the absolute values match).

The absolute values need to be computed for displaying the gradients (as you cannot display values <0), but they shouldn't be used for further processing.