"RGBtoYCbCr(): Instance is not a RGB image."
Closed this issue · 2 comments
boytom commented
When I load a .png picture and convert it to YCbCr, The "RGBtoYCbCr(): Instance is not a RGB image." excepion is throwed. I find out the problem is that the png file has an alpha channel and the _spectrum is 4, but RGBtoYCbCr requires the value of _spectrum is 3. So, what should I do? So sorry about my poor English.
dtschump commented
You can apply the RGB to YCbCr transform only on the three first channels, by using a shared image :
CImg<> rgba("file_rgba.png");
CImg<> rgb = rgba.get_shared_channels(0,2);
rgb.RGBtoYCbCr(); // Here, image 'rgba' is modified since 'rgb' is a shared image.
boytom commented
Thanks a lot!