Is there a way to extract the width/diameter of the contour lines?

2 ビュー (過去 30 日間)
Micke Malmström
Micke Malmström 2016 年 1 月 18 日
回答済み: Star Strider 2016 年 1 月 18 日
I have this image which is an intensity plot of my laser beam:
Now I want to find the horizontal and vertical (1/e^2) diameter (distance is 100 µm/px). Do you have any suggestions on how to go about fitting an ellipse at the 1/e^2 threshold.
the countour function seams to draw nice interpolated lines would there be any idea in trying to extract the information from this plot? If I can specify the counter to only be drawn at the 1/e^2 level?
  1 件のコメント
Micke Malmström
Micke Malmström 2016 年 1 月 18 日
編集済み: Micke Malmström 2016 年 1 月 18 日
This is what I have so far which seams to do fine:
d=dir('*.cma'); & find all files from the Pyrocam III
for ii= 1:length(d)% 1:1%
data=importdata(d(ii).name);
data=data(55:end,:); % remove bad pixels
data=data./max(data(:)).*exp(2); % normalize and multiply by e^2
% data(data<0)=0; % Remove negative values, (not needed here)
%
% figure(1);clf
% imagesc(data);
% axis image; hold on
% colormap('jet');
% pause(0.01) % to see that it looks reasonable
% Draw contour
[C,h] = contour(data,'LineWidth',2, 'LevelList',1, 'LineColor','r');
% Calculate Horizontal and Vertical extent multiply by 0.1 mm/px
Hw(ii)=(max(C(1,2:end))-min(C(1,2:end)))*.1;
Vw(ii)=(max(C(2,2:end))-min(C(2,2:end)))*.1;
end

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

採用された回答

Image Analyst
Image Analyst 2016 年 1 月 18 日
Get a binary image of your data where it's more than 1/e^2
binaryImage = data > 1 / exp(2);
Now get the boundaries:
boundaries = bwboundaries(binaryImage);
x = boundaries{:,2};
y = boundaries{:,1};

その他の回答 (1 件)

Star Strider
Star Strider 2016 年 1 月 18 日
If I understand correctly what you want, you can draw a specific contour (with a second call to contour) at the 1/e^2 level with:
C = contour(data, [1 1]*(1/e^2), 'LineStyle','none');
contour(data,'LineWidth',2, 'LevelList',1, 'LineColor','r');
The ‘C’ variable will then have the (x,y) coordinates of the ‘1/e^2’ contour.

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by