Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Weird result while finding angle

Hi

I wanted to find the angle of a curve at every pixel. For that, I applied canny edge detection. For test image, i took a filled rectangle. So obviously, canny edge result is just a rectangle.

Then i applied Sobel derivative in x and y direction and to find the angle, i took arctan(dy/dx). ( dx = dx+0.001 to avoid divide by zero)

For vertical side, i got an angle of 0 which is true since dy=0 in vertical direction and dx is some high value.

But for horizontal side also, i got zero. I don't understand why. When i took its corresponding dx,dy values, dx = 0.001... and dy = 0. Isn't it wrong to get dy = 0 on the horizontal side of the rectangle?

I checked the dy image, and it clearly shows the top and bottom sides of the rectangle. But still, why dy = 0 on that side?

Below is my dx and dy images:

image descriptionimage description

Weird result while finding angle

Hi

I wanted to find the angle of a curve at every pixel. For that, I applied canny edge detection. For test image, i took a filled rectangle. So obviously, canny edge result is just a rectangle.

Then i applied Sobel derivative in x and y direction and to find the angle, i took arctan(dy/dx). ( dx = dx+0.001 to avoid divide by zero)

For vertical side, i got an angle of 0 which is true since dy=0 in vertical direction and dx is some high value.

But for horizontal side also, i got zero. I don't understand why. When i took its corresponding dx,dy values, dx = 0.001... and dy = 0. Isn't it wrong to get dy = 0 on the horizontal side of the rectangle?

I checked the dy image, and it clearly shows the top and bottom sides of the rectangle. But still, why dy = 0 on that side?

Below is my dx and dy images:image:

image description

My dy image:

image description

Weird result while finding angle

Hi

I wanted to find the angle of a curve at every pixel. For that, I applied canny edge detection. For test image, i took a filled rectangle. So obviously, canny edge result is just a rectangle.

Then i applied Sobel derivative in x and y direction and to find the angle, i took arctan(dy/dx). ( dx = dx+0.001 to avoid divide by zero)

For vertical side, i got an angle of 0 which is true since dy=0 in vertical direction and dx is some high value.

But for horizontal side also, i got zero. I don't understand why. When i took its corresponding dx,dy values, dx = 0.001... and dy = 0. Isn't it wrong to get dy = 0 on the horizontal side of the rectangle?

I checked the dy image, and it clearly shows the top and bottom sides of the rectangle. But still, why dy = 0 on that side?

Below is my dx image:

image description

My dy image:

image description