필터 지우기
필터 지우기

How create plot of intensity versus frequency of image?

조회 수: 4 (최근 30일)
Neda
Neda 2018년 6월 10일
댓글: Neda Azarmehr 2018년 6월 10일
imhist function will give a plot of intensity versus frequency, or we can normalize it like follow, but how we can make a plot like attached? it looks like an area plot. any comment appreciated.
clc;
close all;
clear all;
I = dicomread('IM_0007-Bmode');
for fr = 1:size(I,4)-1
img(:,:,fr) = rgb2gray(I(:,:,:,fr));
end
im1 = double(img(:,:,1));
%// Create normalized images
Inormalized = double(im1)./double(max(im1(:)));
%// Convert back to uint8
% im2Norm = im2uint8(Inormalized);
imhist (Inormalized);
minVal = min(Inormalized(:));
maxVal = max(Inormalized(:));

채택된 답변

Image Analyst
Image Analyst 2018년 6월 10일
Try this:
histogram(I, 'normalization', 'probability')
title('Probability vs. Intensity', 'FontSize', 15);
xlabel('Intensity (gray level)', 'FontSize', 15);
ylabel('Probability', 'FontSize', 15);
grid on;
  댓글 수: 5
Image Analyst
Image Analyst 2018년 6월 10일
Yes it is. It also has no edge lines between the bins, which is an option you can have or not have. Excel calls it a column chart but most people, including at the Mathworks, call it a bar chart.
Neda Azarmehr
Neda Azarmehr 2018년 6월 10일
thank you.

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

추가 답변 (1개)

Ameer Hamza
Ameer Hamza 2018년 6월 10일
You can do something like this
[counts bins] = imhist(im1);
% normalize 'bins' and 'counts' here. e.g.
bins = bins/255;
counts = counts/sum(counts);
bar(bins, counts);
ax = gca;
ax.Children.BarWidth = 1;
  댓글 수: 1
Neda
Neda 2018년 6월 10일
it gave me just two bin, 0 and 4, and if I do this xlim ([0 1]); nothing return back.

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

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by