MATLAB: Comparing images

images

I want to compare images by taking a difference of their images but those values are just limited to 0 and 255. if i subtract 0-255 it gives me a 0 and if its 255-0 the answer is 255. how do i make them subtract like normal numbers so i can calculate the difference and get negative values too?

Best Answer

Cast them to double before you add or subtract uint8 or uint16 images.
diffImage = double(uint8Image1) - double(uint8Image2);
Related Question