Recovering Distorted Image Using loops and 2d Arrays

I have this code that is supposed to undo a distortion from one .ppm file and send the correct image to another to a .ppm file that has a picture inside. I have done all of the re-scaling for the blue pixels and got the correct image (as you can see done in the if statement below) .
My image comes out in the blue channel but I need to move the blue channel image values into the red channel; this I do not know how to do. I'm not looking for the exact code I just want a hint or some guidance as to how I would go about this! Thank you!

1
2
3
4
5
6
7
8
9
10
  void recoverImage3(Pixel image[][NCOLS]) {
for(int r = 0; r < NROWS; r++) {
    for(int c = 0; c < NCOLS; c++) {
        if(image[r][c].blue<16)
            image[r][c].blue*=16;
        else
            image[r][c].blue=0;
      }
    }
 }


The entire code for the project is here if needed; http://pastebin.ca/3147864
Last edited on
Topic archived. No new replies allowed.