Problem with imhist after modify image

Hello, Why After histogram in 0 to 1 range?
I=imread('cameraman.tif');
figure
subplot(2,2,1);
imshow(I);
title('Original');
subplot(2,2,2);
imhist(I);
title('Original Histogram');
I=double(I);
fis=readfis('FIS4');
[m n]=size(I);
for i=1:m
for j=1:n
I(i,j)=evalfis(I(i,j),fis);
end
end
subplot(2,2,3);
imshow(uint8(I));
title('After');
subplot(2,2,4);
imhist(I);
title('After Histogram');

답변 (2개)

Ahmet Cecen
Ahmet Cecen 2016년 3월 11일

1 개 추천

For now use:
imhist(uint8(I))
That will get your work done, although it puzzles me why that is necessary, because imhist normally accepts double.

댓글 수: 4

Dani D
Dani D 2016년 3월 11일
I use uint8(I) for imshow,not imhist
Ahmet Cecen
Ahmet Cecen 2016년 3월 11일
... and I am telling you to use it for imhist as well, it will make it work...
rjvyas
rjvyas 2017년 10월 6일
I had the same problem and using imhist(uint8(I)) worked! Thank you
You can also use histogram:
histogram(I);
which doesn't require conversion to integer.

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

Julie
Julie 2016년 3월 11일

0 개 추천

It changed the range, sometimes it does grayscale in 0-255, and sometimes it does it in 0-1. It won't make a difference to your image. To fix your histogram use
imhist(I.*255);

댓글 수: 3

Dani D
Dani D 2016년 3월 11일
Thanks and i use it but don't effect.
Zahra Saman
Zahra Saman 2018년 4월 12일
please help me in this problem
Zahra Saman
Zahra Saman 2018년 4월 12일
please help me in this problem

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

태그

질문:

2016년 3월 11일

댓글:

2018년 4월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by