Ask Your Question

gcroonen's profile - activity

2019-07-28 16:28:23 -0600 received badge  Popular Question (source)
2013-03-05 06:10:53 -0600 asked a question Indexed images in OpenCV; Read/write palette?

After reading a lot of threads here and there on indexed images in OpenCV I have posted a feature request for how OpenCV handles indexed images here:

http://code.opencv.org/issues/2863

Feel free to add to my request. Did any of you find a quick work-around for storing a PNG with a palette in OpenCV?

The solution I am now using involves back and forth colormap conversions. I first deconvert the default RGB image, that OpenCV returns, back to the single channel indexed variety (just split the image and discard any two of the three channels). I do my processing and then convert the image to an RGB image that I can store. This image will display correctly in other viewers. For running evaluations of my processing I need the index values again; I convert the OpenCV images back to indexed images using a hardcoded colormap.