Libraw - How can I get a image just with the red pixels using Libraw?

261 views Asked by At

I'm using Libraw to a project which is about manipulating raw image files. I need to implement a feature that from a raw file I need to export an image just with the red pixels (and other 3 images for blue, green and green2 pixels). I've tried the 4channels sample but that just gave me a picture with a black and gray scale. I've tried modifying the code with this before export the image:

for (int c = 0; c < S.iwidth; c++){
    for(int r=0;r<S.iheight;r++){
        printf("Row:%d Column:%d Color:%d Max Rows:%d Max Col:%d\n",r,c,RawProcessor.COLOR(r,c),S.iheight,S.iwidth);
        //check if is a red pixel
        if(RawProcessor.COLOR(r,c)!=0){
            RawProcessor.imgdata.image[r*c][0] = 20000;
            RawProcessor.imgdata.image[r*c][1] = 0;
            RawProcessor.imgdata.image[r*c][2] = 0;
            RawProcessor.imgdata.image[r*c][3] = 0;
    }
}

This just give me a grayscale image with black dots in pixels which are not red. I want an image when you can see clearly the red color.

Can anyone help me with this problem?

Best regards

0

There are 0 answers