How can I remove the black line from the bottom of histogram plotting?

9 ビュー (過去 30 日間)
Batool Engineer
Batool Engineer 2017 年 1 月 25 日
コメント済み: Batool Engineer 2017 年 1 月 26 日
My code is as below:
f=imread('D:\001_1.bmp');
figure(1)
imshow(f,[]);
figure(2)
imhist(f);axis([0 255 0 140]);

採用された回答

Image Analyst
Image Analyst 2017 年 1 月 25 日
Try this:
fontSize = 20;
grayImage=imread('cameraman.tif');
subplot(1,2,1)
imshow(grayImage,[]);
axis on
subplot(1,2,2)
[counts, bins] = histcounts(grayImage, 256);
bar(bins(1:end-1), counts, 'BarWidth', 1);
title('Histogram', 'FontSize', fontSize);
xlabel('Gray Level', 'FontSize', fontSize);
ylabel('PixelCount', 'FontSize', fontSize);
grid on;
xlim([0,256])
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
  6 件のコメント
Image Analyst
Image Analyst 2017 年 1 月 26 日
Try casting to double and using (:):
[counts, bins] = hist(double(grayImage(:)), 256);
Batool Engineer
Batool Engineer 2017 年 1 月 26 日
I am so thankful for your help. The histogram was appeared as I like
Thank you again

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2017 年 1 月 25 日
f=imread('D:\001_1.bmp');
subplot(1,2,1)
imshow(f,[]);
subplot(1,2,2)
histogram(f, 256);
axis([0 255 0 140]);
  3 件のコメント
Adam
Adam 2017 年 1 月 25 日
Which version of Matlab are you using? Histogram was introduced in R2014b
Batool Engineer
Batool Engineer 2017 年 1 月 25 日
I'm using Matlab R2013a

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by