Single channelled images in CImg -


i use cimg image processing work. work on gray scale jpg, bmp, tiff images presently. problem facing cimg function follows:

cimg stores pixel values in following way. r1r2r3r4............g1g2g3g4.........b1b2b3b4.........

even grey scale images, 3 different channels created separately. makes work complicated. copying values 1 image another, need copy components of pixels. need iterate across channels make algorithm slow.

since work grey scale images not matter me whether single channelled or multichannelled.is there way convert 3 channelled image single channelled in cimg. please let me know asap.

thank in advance

use cimg::channel(int c) function:

cimg<float> img("input.jpg"); //3 channel img.channel(0); //now single channel img.save("output.jpg"); //will save 3 channel image again 

http://cimg.sourceforge.net/reference/structcimg__library_1_1cimg.html#a83af84298188d07c59c49dd0ed4d2714


Comments

Popular posts from this blog

unicode - Are email addresses allowed to contain non-alphanumeric characters? -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c++ - Convert big endian to little endian when reading from a binary file -