Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How does the Sobel operator handle gradients over 255?

Hi,

I'm currently trying to implement my own Sobel operator and I'm using the OpenCV operator as reference. From what I can see, most edges I find are the same, but some of them go over 255 which causes an overflow of the uint8 type. I've tried setting those gradients to 255 and scaling the values to 0-255, but the result still isn't there.

An example below:

original image

OpenCV Sobel

My Sobel operator

My Sobel operator with overflowing gradients set to 255

My Sobel operator with values scaled to 0-255

I would be very grateful for any tips and tricks.

How does the Sobel operator handle gradients over 255?

Hi,

I'm currently trying to implement my own Sobel operator and I'm using the OpenCV operator as reference. From what I can see, most edges I find are the same, but some of them go over 255 which causes an overflow of the uint8 type. I've tried setting those gradients to 255 and scaling the values to 0-255, but the result still isn't there.

An example below:

original imageoriginal image

OpenCV SobelOpenCV Sobel

My Sobel operatorMy Sobel operator

My Sobel operator with overflowing gradients set to 255My Sobel operator with overflowing gradients set to 255

My Sobel operator with values scaled to 0-255My Sobel operator with values scaled to 0-255

I would be very grateful for any tips and tricks.

How does the Sobel operator handle gradients over 255?

Hi,

I'm currently trying to implement my own Sobel operator and I'm using the OpenCV operator as reference. From what I can see, most edges I find are the same, but some of them go over 255 which causes an overflow of the uint8 type. I've tried setting those gradients to 255 and scaling the values to 0-255, but the result still isn't there.

An example below:

original image

OpenCV Sobel

My Sobel operator

My Sobel operator with overflowing gradients set to 255

My Sobel operator with values scaled to 0-255

I would be very grateful for any tips and tricks.