imhist function is not generating
조회 수: 5 (최근 30일)
이전 댓글 표시
i=imread('toycars2.png');
figure
subplot(1,2,1)
imshow(i)
subplot(1,2,2)
imhist(i)
when ı run this code it looks like this.why doesn't it show the histogram?

댓글 수: 0
답변 (1개)
DGM
2021년 3월 31일
imhist() expects its inputs to be single-channel images. You could either take the histogram of some overall brightness metric:
i=imread('sources/table.jpg');
figure
subplot(1,2,1)
imshow(i)
subplot(1,2,2)
imhist(rgb2gray(i)) % this is luma
or you could set up everything and do histograms for each channel
i=imread('sources/table.jpg');
figure
subplot(3,2,[1 3 5])
imshow(i)
for c=1:3
subplot(3,2,c*2)
imhist(i(:,:,c))
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Filtering and Enhancement에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!