CImg
CImg copied to clipboard
What exactly does img.RGBtoXYZ() do ?
If img has pixel data ordered with RGB format i.e. R1,G1,B1, R2,G2,B2, ... ?? Is img.RGBtoXYZ() supposed to change the data ordering to CImg format i.e. R1,R2,R3... G1,G2,G3... B1,B2,B3...
img.RGBtoXYZ() assumes your instance is an image with 3 channels, each channel representing the R,G,B components of the image. With CImg, the corresponding buffer is stored in non-interleaved format, so : R1 R2 R3... G1 G2 G3... B1 B2 B3....
This method converts each RGB value of such an image into a XYZ representation (see https://en.wikipedia.org/wiki/CIE_1931_color_space).
Thank You David.. I was completely off-base, until I received you note, I misunderstood CImg::RGB2XYZ() to be a conversion from inter-leaved RGB to non-interleaved CImg image format; and, thus could not understand why it was wiping out my CImg<T> pixel data.
I love working with CImg and I'm trying to learn as much as possible about it by reading the PDF reference document, which I find very brief in some sections.
Many Thanks for making CImg available to the public, it is truly one of the best C++ packages I've ever encountered.
L Godio, from Atlanta, GA USA
On Tue, Sep 1, 2020 at 4:02 PM David Tschumperlé [email protected] wrote:
img.RGBtoXYZ() assumes your instance is an image with 3 channels, each channel representing the R,G,B components of the image. With CImg, the corresponding buffer is stored in non-interleaved format, so : R1 R2 R3... G1 G2 G3... B1 B2 B3.... This method converts each RGB value of such an image into a XYZ representation (see https://en.wikipedia.org/wiki/CIE_1931_color_space).
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dtschump/CImg/issues/284#issuecomment-685100671, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHJ6BCYYFN3H2RYPJVXYLKDSDVHMPANCNFSM4QSDO2GA .
Thanks for the kind words.
If you need a function to deinterlace a color buffer from RGBRGBRGB... to RRRRR...GGGG...BBBB (and vice-versa), then you may have a look to CImg<T>::permute_axes().
OK, ? If I want to convert from inter-leaved RGB to non-interleaved CImg image format , what 'axis_order' do I pass to permute_axes ( const char ∗const axes_order ) ?
Assuming you have, e.g. a unsigned char *buffer encoding a RGB image with size WxH, then
CImg<unsigned char> img = CImg<unsigned char>(buffer,3,W,H).permute_axes("yzcx");
should do the job.