I've successfully managed to remove the red pixels and now I want to enhance the other pixels, so that the message is more clear.

The way I am try to do is the the following:

  • If the pixel is red I convert into white (if statement)

  • Else if the pixel is not white (if it's neither red nor white, it has some other color), I try to convert the pixel into pure blue.

For some reason the else if statement doesn't work and I can't get why.

if (triple.rgbtBlue == 0x00 && triple.rgbtGreen == 0x00 && 
    triple.rgbtRed == 0xff)
     triple.rgbtBlue = 0xff;
     triple.rgbtGreen = 0xff;
else if (triple.rgbtBlue != 0xff && triple.rgbtGreen != 0xff && 
         triple.rgbtRed != 0xff)
    triple.rgbtBlue = 0xff;
    triple.rgbtGreen = 0x00;
    triple.rgbtRed = 0x00;

1 Answer 1


You should be doing something to hide the red noise but notice in your code you actually just turn your problem from red to blue, nothing else. What do you do with the white in your image? The colors in your image are white and shades of red. So, you should proceed to turn the reds to something that lowers its noise and whites to something that enhances the image or solves the problem.

  • But I'm not turning red to blue! The if statement turns pure red into white. And I don't want to change white. I just want to turn pixels that are not red nor white into pure blue.
    – johnlock1
    Commented Sep 9, 2017 at 8:47
  • In your code you clearly change pure red to white and white to pure blue.What about the colors which are lighter shades of red not pure red, you don't change them?
    – sk.76
    Commented Sep 11, 2017 at 14:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .