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

1 view (last 30 days)
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.

Answers (1)

Bjorn Gustavsson
Bjorn Gustavsson on 21 Jun 2019
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 Comments
Darshika Gumare
Darshika Gumare on 21 Jun 2019
Sir, actually I have already said in my answer previously the whole error which is appearing after running the code.
Bjorn Gustavsson
Bjorn Gustavsson on 21 Jun 2019
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?

Sign in to comment.

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!