dear all,
I am new in VC++ and CImg Library. I have two problems regarding the use of CImg commands:
1) How to convert RGB image into grayscale image? Is there a specific command in CImg which can do perform it?
2) How to write pixel values into notepad?
Looking forward to any replies. Thanks in advance.
I don't use CImg myself, but I have done RGB -> grayscale conversions. Even if there is a built-in function, it's very easy to do on your own by manipulating the individual pixels. Although you'll need to modify the syntax to suit Cimg, this
documentation contains sample code for RGB->gray using
EasyBMP. (See page 4.) The relevant portion is here:
-
int Gray = (int) floor( 0.299*Input(i,j)->Red +
-
0.587*Input(i,j)->Green +
-
0.114*Input(i,j)->Blue );
-
Notice the heaviest weight on green, followed by red and then blue. This is because the human eye is most sensitive to green, followed by red and then blue. ;) -- Paul