OpenCV image conversion from RGB to Grayscale using imread giving poor results

前端 未结 3 1364
梦毁少年i
梦毁少年i 2021-01-01 17:49

I\'m loading a 24 Bit RGB image from a PNG file into my OpenCV application.

However loading the image as grayscale directly using imread gives a very po

3条回答
  •  甜味超标
    2021-01-01 18:12

    I have had a similar problem once, working with OpenGL shaders. It seems that the first container that OpenCV reads your image with does not support all the ranges of color and hence you see that the image is a poor grayscale transformation. However once you convert the original image into grayscale using cvtColor the container is different from the first one and supports all ranges. In my opinion the first one uses less than 8 bits for grayscale or changing to the grayscale uses a bad method. But the second one gives smooth image because of more bits in gray channel.

提交回复
热议问题