MATLAB: Uint8 vs int8 in imshow

camermanImage Processing Toolbox

Hello, What is difference between these? When i use int8 , the most of pixel been 127 and when i use uint8 the problem is solve.
I=imread('cameraman.tif');
I = uint8(I);
imshow(I);
I=imread('cameraman.tif');
I = int8(I);
imshow(I);

Best Answer

When you give int8() a value that is greater than 127, then it "saturates" and returns 127. A lot of your input values are greater than 127 so they are "saturating" at 127.
The same kind of thing happens for uint8 if you give it a value greater than 255: it saturates at 255.