Why is imhist() not clipping data?

I can't seem to find out why that imhist plots aren't clipping the data. Or why the color bar is inside of the plot.
figure, sgtitle(strcat('Number of intensity levels = ',string(n_lvls)))
subplot(2,2,1), imshow(og_img), axis image, title('Original small matrix')
subplot(2,2,2), imhist(og_img), ylim([0 1000]), title('Original Image Histogram')
subplot(2,2,3), imshow(histeq(og_img)), axis image, title('Histogram equalized')
subplot(2,2,4), imhist(histeq(og_img)), title('Histogram equalized image histogram')

댓글 수: 1

Adam Danz
Adam Danz 2020년 10월 4일
편집: Adam Danz 2020년 10월 4일
Could you provide the necessary data so we can attempt to reproduce this?
Also, whenever you report a problem like this, always include the software version number. (see ver).

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

답변 (1개)

Image Analyst
Image Analyst 2020년 10월 4일

0 개 추천

This works fine for me
og_img = imread('cameraman.tif');
n_lvls = 100;
figure, sgtitle(strcat('Number of intensity levels = ',string(n_lvls)))
subplot(2,2,1), imshow(og_img), axis image, title('Original small matrix')
subplot(2,2,2), imhist(og_img)
% ylim([0 1000])
title('Original Image Histogram')
subplot(2,2,3), imshow(histeq(og_img)), axis image, title('Histogram equalized')
subplot(2,2,4), imhist(histeq(og_img)), title('Histogram equalized image histogram')
Why are you calling ylim?

댓글 수: 3

Sorry, I uploaded the code with ylim unintentionally. I was trying to troubleshoot the problem with that. The image I uploaded was the output without ylim in the code.
This is another example code and I am using R2020b.
clc, clear, close all
Eye = imread('DR_eyeball.jpg');
Eye_gray = rgb2gray(Eye);
figure, sgtitle('Grayscale and Histogram Equilization')
subplot(2,2,1), imshow(Eye_gray), axis image, title('Original Grayscale')
subplot(2,2,2), imhist(Eye_gray), title('Original Grayscale Histogram')
Image Analyst
Image Analyst 2020년 10월 5일
It appears sgtitle() is causing the gray scale wedge to appear in the wrong place. I'll contact the Image Processing team developers about it. If you take out sgtitle() it seems to work fine.
Zackary Coburn
Zackary Coburn 2020년 10월 5일
Oh ok. Thank you. And about the clipping, if I change the Clipping Style to 'rectangle' from '3dbox', then the data is properly clipped in the plot.

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

질문:

2020년 10월 3일

댓글:

2020년 10월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by