color depth reduction with opencv and LUT
I'd like to perform a color reduction via color depth scaling. Like this example: the first image is CGA resolution, the second is EGA, the third is HAM. I'd like to do it with cv::LUT because i think it is the betterway to do it. I can do with greyscale with this code: Mat img = imread("test1.jpg", 0); uchar* p; Mat lookUpTable(1, 256, CV_8U); p = lookUpTable.data; for( int i = 0; i < 256; ++i) p[i] = 16 * (i/16) LUT(img, lookUpTable, reduced); original: color reduced: but if i try to do it with color I get strange result.. with this code: imgColor = imread("test1.jpg"); Mat reducedColor; int