How do I find the minimum pixel value for every point along a line automatically ?
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
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 个评论
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?
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!