Loss of brightness / contrast when converting from <Gray, float> image to <Gray, Byte> image

We are using OpenCV with Emgu 2.4.9 wrapper.

When we convert Image<Gray,float>

to Image<Gray,Byte>

(using convert<Gray,Byte>()

) the brightness / contrast is reduced. We use Image<Gray,Byte>

to display while Image<Gray,float>

used temporarily for processing (like convolution).

However, when Image<Gray,float>

saved as JPEG, I see the desired intensity / brightness level.

When I checked the method Image.Save()

, it looks like it ends up calling the OpenCV imwrite_ () function, which in turn converts the Float image to byte format: 'image.convertTo (temp, CV_8U);

So, I would expect the intensity level to decrease when Image<Gray,float>

saved as JPEG. But this is not the case (although the same convertTo () method, which, in turn, calls the OpenCV cvt_ () function).

But, when the floating point image is converted to byte and the brightness / contrast is preserved, it decreases.

In both cases, I believe it saturate_cast<>

will be called.

Related questions here: Converting Emgu images from Image <Gray, float> to Image <Gray, Byte> results in a loss of intensity?

Can anyone please describe what is happening and how to keep the brightness / intensity when converting from Image<Gray,float>

to Image<Gray,Byte>

?

+3


source share





All Articles