views:

80

answers:

2

How do you invert an image (reversing grayscale) in MATLAB?

+5  A: 

If it's a grayscale intensity image of class uint8, you can do this:

reversedImg = 255-img;

If it's a grayscale intensity image of class double, the pixel values should be between 0 and 1, so you can do this:

reversedImg = 1-img;
gnovice
+4  A: 

I think that you're looking for the imcomplement function if you have the imaging processing toolbox.

Justin Peel