Ask Your Question

# Revision history [back]

### Conversion from CV_64F to CV_8U images in Edge Detection Tutorial

Hello together,

In the "One important Matter" section the conversion from 64F to 8U is mentioned. https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_gradients/py_gradients.html#gradients

It says that the image should be calculated in a 64F image format, which is good. But the conversion with taking the absolute value and then converting it to 8U is wrong in my eyes.

The image should be normalized something like:

min = np.min(sobelx_64f)
sobelx_64f = sobelx64f_-min #to have only positive values
max=np.max(sobelx64f)
div=max/255 #calculate the normalize divisor
sobelx_8u=np.uint8(sobelx_64f/div)


Since I am quite new to image processing, could somebody please validate this?

Thank you Tschokokuki

### Conversion from CV_64F to CV_8U images in Edge Detection Tutorial

Hello together,

In the "One important Matter" section the conversion from 64F to 8U is mentioned. https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_gradients/py_gradients.html#gradients

It says that the image should be calculated in a 64F image format, which is good. But the conversion with taking the absolute value and then converting it to 8U is wrong in my eyes.eyes. It only works because the image is black and white. Because the negative value becomes 0 and the highest value becomes black. But in general the gray values in between will be calculated wrong.

The image should be normalized something like:

min = np.min(sobelx_64f)
sobelx_64f = sobelx64f_-min sobelx-min #to have only positive values
max=np.max(sobelx64f) max=np.max(sobelx)
div=max/255 #calculate the normalize divisor
sobelx_8u=np.uint8(sobelx_64f/div)


Since I am quite new to image processing, could somebody please validate this?

Thank you Tschokokuki

### Conversion from CV_64F to CV_8U images in Edge Detection Tutorial

Hello together,

In the "One important Matter" section the conversion from 64F to 8U is mentioned. https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_gradients/py_gradients.html#gradients

It says that the image should be calculated in a 64F image format, which is good. But the conversion with taking the absolute value and then converting it to 8U is wrong in my eyes. It only works because the image is black and white. Because the negative value becomes 0 and the highest value becomes black. But in general the gray values in between will be calculated wrong.

The image should be normalized something like:

min = np.min(sobelx_64f)
sobelx_64f = sobelx-min sobelx_64f-min #to have only positive values
max=np.max(sobelx) max=np.max(sobelx_64f)
div=max/255 #calculate the normalize divisor
sobelx_8u=np.uint8(sobelx_64f/div)


Since I am quite new to image processing, could somebody please validate this?

Thank you Tschokokuki