How do I find the minimum pixel value for every point along a line automatically ?

1 回表示 (過去 30 日間)
Darshika Gumare
Darshika Gumare 2019 年 6 月 21 日
コメント済み: Bjorn Gustavsson 2019 年 6 月 21 日
I have a point in an image with a small crack at the notch tip as shown in the figure 1. I want to find the minimum value of the pixel at every horizontal line as shown in fig 2. The ultimate motive is to find the crack length automatically without imtool.

回答 (1 件)

Bjorn Gustavsson
Bjorn Gustavsson 2019 年 6 月 21 日
Calculate the pixel intensities along a line-segment with interp2:
x_line = 123:432; % or something like that
y_line = linspace(321,312,numel(x_line)); %
Igray = rgb2gray(YourImg);
I_line = interp2(Igray,x_line,y_line);
% Then find minimum along I_line:
[I_min,idxMin] = min(I_line);
HTH
  10 件のコメント
Darshika Gumare
Darshika Gumare 2019 年 6 月 21 日
Sir, actually I have already said in my answer previously the whole error which is appearing after running the code.
Bjorn Gustavsson
Bjorn Gustavsson 2019 年 6 月 21 日
Interesting. I run this code-snippet without problems:
Igray = peaks(1234);
subplot(4,1,1:3)
imagesc(Igray)
hold on
x_line = 623:662;
y_line = linspace(421,412,numel(x_line)); %;
plot(x_line,y_line,'k')
I_line = interp2(qwe,x_line,y_line);
subplot(4,1,4)
plot(x_line,I_line)
[I_min,idxMin] = min(I_line) % returns:
% I_min =
% -1.8975
%idxMin =
% 40
Can you share your code-snippet?

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

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by