imshow(uin​t8(imagema​trix)) and imshow(int​8(imagemat​rix)) gives different results although pixel values are between 0-255

1 view (last 30 days)
I want to understand effects of mean filter in zro mean gaussian noised image with different window size. image is read by imread and assigned to matrix.Although pixel values in the image matrix are between 0 and 255, imshow(uint8(imageMatrix)) and imshow(int8(imageMatrix)) gives different results-in int8 case the image is brighter for example.Why can be this happen, what is the reason and I am not sure which one is true while examining the effects of mean filter on zero-mean gaussian variance noised image? Thanks in advance friends.

Accepted Answer

Walter Roberson
Walter Roberson on 8 Apr 2020
>> uint8(255)
ans =
uint8
255
>> int8(uint8(255))
ans =
int8
127
When you int8() data that is in the range 0 to 255, all values that are 128 or more are turned into 127, the maximum value for the range.
When you imshow() an int8 image, it notices that it is int8, and scales the colors to run from -128 to +127, with 0 being the middle color and 127 being the brightest color. But since you started with uint8 you do not have any values that are negative, and you will probably have a number of locations that int8() changed from being 128 or more into 127 which is maximum brightness for int8.

More Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!