In the documentation (http://cimg.eu/reference/structcimg__library_1_1CImg.html#a24f3b43daa4444b94a973c2c3fff82c5), you can read that the N°7 constructor requires an array of values to fill the image :
values = Pointer to the input memory buffer.
You must know that I'm working with a RGB 2D image (so, a "normal"/"common" image).
Thus, I filled a vector (= more or less an array) with Nx3 values. N is the number of pixels, and the number "3" is because I use red, green and blue. I set the first value to 0, the 2nd to 0, the 3rd to 255 and these 3 operations are repeated N times. That's why my vector, which is named w
, looks like that : {0, 0, 255 ; 0, 0, 255 ; etc.}
I wrote this constructor : cimg_library::CImg<unsigned char>(&w[0], width, height, 2, 3);
to say that there are 3 channels, a depth of 2 (since I use 2D), and to give my values (width, height and pixels).
I should obtain a entirely blue image. But it's yellow. Why ? Did I badly used the vector ?