How to plot intensity profile of an image

170 ビュー (過去 30 日間)
Viron Gil Estrada
Viron Gil Estrada 2018 年 3 月 22 日
コメント済み: Vivek 2022 年 8 月 10 日
I want to plot the intensity profile of this image. I tried using improfile but I don't really know how it works. Can anyone help?
  1 件のコメント
Walter Roberson
Walter Roberson 2018 年 3 月 22 日
An intensity profile along which direction?
If you want a profile along a horizontal or vertical line then just use array indexing to extract the vector, and then plot it.

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

採用された回答

Akira Agata
Akira Agata 2018 年 3 月 22 日
Like this?
I = imread('Capture.PNG');
x = [0 size(I,2)];
y = [size(I,1)/2 size(I,1)/2];
c = improfile(I,x,y);
figure
subplot(2,1,1)
imshow(I)
hold on
plot(x,y,'r')
subplot(2,1,2)
plot(c(:,1,1),'r')
hold on
plot(c(:,1,2),'g')
plot(c(:,1,3),'b')
  5 件のコメント
Warid Islam
Warid Islam 2019 年 7 月 9 日
Hi,
How can we plot the intensity profile of the same image along the vertical direction instead of the horizontal direction? Thank you.
Elif
Elif 2021 年 8 月 4 日
How can we measure the areas under these curves?

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

その他の回答 (4 件)

Akira Agata
Akira Agata 2019 年 7 月 9 日
Hi Warid-san,
You can do it by the same way, like the following.
I = imread('Capture.PNG');
% Since size(I,2)/2 = 215.5, I have set the value '215' directly for x
x = [215 215];
y = [0 size(I,1)];
c = improfile(I,x,y);
figure
subplot(2,1,1)
imshow(I);
hold on
plot(x,y,'r')
subplot(2,1,2)
plot(c(:,1,1),'r')
hold on
plot(c(:,1,2),'g')
plot(c(:,1,3),'b')
Capture2.PNG
  4 件のコメント
Akira Agata
Akira Agata 2020 年 3 月 23 日
Hi Manoj-san,
Could you upload a sample image file for trying?
Vivek
Vivek 2022 年 8 月 10 日
Hi Akira San,How Can you plot the 1D profile of a rectangular region instead of just line ?Tx,vivek

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


Lorenzo Gentili
Lorenzo Gentili 2019 年 8 月 20 日
Hi Akira,
I'm trying to obtain an intesity profile of the image below, but I need more than a line. I would like to have at least 5 vertical line in order to understand how the intesity vary in different point of the image ( lets say the 2 boundaries, the center and 2 point between the boundaries and the center). Is it possible to obtain an unique intensity profile that is the sum of 5 intesity profile obtained by the verical lines ?
Thank you for your help
Lorenzo untitled1.png
  4 件のコメント
YOGITAA YOGITAA
YOGITAA YOGITAA 2022 年 3 月 2 日
could ypu please share your code, i have the same problem
Image Analyst
Image Analyst 2022 年 3 月 3 日
編集済み: Image Analyst 2022 年 3 月 3 日
@YOGITAA YOGITAA, here is the code:
verticalProfile = mean(grayImage(:, column1:column2), 2);
horizontalProfile = mean(grayImage(row1:row2, :), 1);

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


r r
r r 2020 年 5 月 15 日
編集済み: Walter Roberson 2020 年 5 月 16 日
I have image of a tumor in it and I want to do it the same way https://www.mathworks.com/matlabcentral/answers/389889-how-to-plot-intensity-profile-of-an-image
, but every time the response is
'improfile' requires Image Processing Toolbox.
Error in line (line 4)
c = improfile(I,x,y);
  1 件のコメント
Walter Roberson
Walter Roberson 2020 年 5 月 16 日
You need the Image Processing Toolbox to use improfile()
improfile() uses linspace() to create vectors of coordinates between the two endpoints, and uses interp2() to interpolate at the coordinates; it does the interpolation once for each color channel.
The question then becomes what coordinates you should interplate at

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


fransec
fransec 2020 年 6 月 9 日
Hello everybody,
Anyone knows how to make an image profile like ones you showed, but but along the diagonal of an image?
Thank you so much.
  2 件のコメント
Walter Roberson
Walter Roberson 2020 年 6 月 9 日
[rows, cols, ~] = size(YourImage);
n = min(rows,cols);
prof_diag = improfile(YourImage, [1 n], [1 n]); %diagonal
prof_antidiag = improfile(YourImage, [n 1], [1 n]); %anti-diagonal
Christopher Gordon
Christopher Gordon 2021 年 2 月 22 日
Hey! Question along the same lines. I have 30 vertical lines across a 1024 column image/matrix. Is there a way that I can interpolate/extrapolate the remaining columns to get the entire image/matrix?

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

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by