Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"RGBtoYCbCr(): Instance is not a RGB image." #86

Closed
boytom opened this issue Sep 11, 2016 · 2 comments
Closed

"RGBtoYCbCr(): Instance is not a RGB image." #86

boytom opened this issue Sep 11, 2016 · 2 comments

Comments

@boytom
Copy link

boytom commented Sep 11, 2016

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
Copy link
Collaborator

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
Copy link
Author

boytom commented Sep 12, 2016

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants