How to get INTENSITY along a spcific curve?

3 ビュー (過去 30 日間)
Steven
Steven 2014 年 1 月 14 日
コメント済み: Image Analyst 2021 年 6 月 30 日
Hi.
How can I get the intensity along a specific curve?
I mean for the following image, I want the intensity along the red circle. How to do so?
The original image is only the grayscale one and I have drawn the red one myself, so I know its data.
Shall I do so for the grayscale image or the binary one?
Thanks so much
Steven

採用された回答

Ashish Uthama
Ashish Uthama 2014 年 1 月 14 日
You could try using improfile, it will let you draw the cirle and then return the values along the profile.
Air code:
imshow(yourRawGrayImage)
% number of points you want to sample the profile with
N = 100;
profileValues = improfile(N)
  10 件のコメント
Image Analyst
Image Analyst 2021 年 4 月 1 日
Correct, I don't. It's just the intensity around the ellipse. Why do you think the spatial frequencies of that are meaningful? Maybe they're just more or less constant, perhaps with a little noise - basically the surrounding gray level of the blob. What information do you want?
Please start your own question with your own image and code attached.
george korris
george korris 2021 年 4 月 1 日
yeah youre write. thanks for your time!
have a nice day!

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2014 年 1 月 14 日
Try this code:
clc; % Clear the command window.
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 24;
% Read in image
grayImage = imread('tire.tif');
% manually create a circle
subplot(2,2,1);
imshow(grayImage);
title('Original Grayscale Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Let user create ellipse.
h = imellipse();
% Create a mask out of it
mask = createMask(h);
subplot(2,2,2);
imshow(mask);
title('Mask Image', 'FontSize', fontSize);
% Find boudnaries and plot over original grayscale image.
boundaries = bwboundaries(mask);
numberOfBoundaries = size(boundaries, 1);
subplot(2,2,1);
hold on;
thisBoundary = boundaries{1};
x = thisBoundary(:,2);
y = thisBoundary(:,1);
plot(x, y, 'g', 'LineWidth', 2);
hold off;
% extract all pixels along this profile
for k = 1 : length(x)
profile(k) = grayImage(y(k), x(k)); % logical indexing
end
subplot(2,2, 3);
plot(profile);
grid on;
title('Profile', 'FontSize', fontSize);
xlabel('Distance', 'FontSize', fontSize);
ylabel('Gray Level', 'FontSize', fontSize);
  12 件のコメント
Anna Schoonen
Anna Schoonen 2021 年 6 月 29 日
sorry I forgot to attach! here is the image.
Image Analyst
Image Analyst 2021 年 6 月 30 日
@Anna Schoonen, please post this in a thread of your own rather than using Steven's 7 year old question.

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

カテゴリ

Help Center および File ExchangeImage Processing and Computer Vision についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by