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

조회 수: 5 (최근 30일)
denisa 2020년 4월 8일
댓글: DGM 2023년 11월 27일
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.
##### 댓글 수: 1이전 댓글 -1개 표시이전 댓글 -1개 숨기기
DGM 2023년 11월 27일
The images always need to be scaled correctly for their class.

댓글을 달려면 로그인하십시오.

### 채택된 답변

Walter Roberson 2020년 4월 8일
>> 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.
##### 댓글 수: 1이전 댓글 -1개 표시이전 댓글 -1개 숨기기
denisa 2020년 4월 9일
Thanks @Walter Roberson .

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by