Using CImg: I read here that you can change an individual pixel's RGB data like this:
CImg<float> img("filename.jpg");
// Change the (100,200) pixel to Red.
img(100,200,0,0) = 255; //R
img(100,200,0,1) = 0; //G
img(100,200,0,2) = 0; //B
but img(100, 200, 0, 0)
returns the type unsigned char *
, which is obviously not a variable as the above snippet implies. When I run the above code, I get "error C2106: '=' : left operand must be l-value" in my build output.
A potential solution would be to use a different version of the CImg
constructor, which takes raw pixel data as its first parameter, but I can't find any information on how to format the data before running it through the constructor - the first parameter is describes as a template in line 9671 of CImg.h.
Any help would be greatly appreciated; I've been at this for a while.