MATLAB Answers

how to use a for loop to find all row ?!

1 view (last 30 days)
Hello, Please Help me?
I want to find the lenght of index <1 = black color in the picture name 'bwcircle_crop'
crack_crop.jpg
but now, I write the code for thr first row but I dont know to use for loop to find the same way in all row.
เส้นแถวแรก.png
Thank you ^^

  0 Comments

Sign in to comment.

Accepted Answer

KSSV
KSSV on 28 Feb 2019
Edited: KSSV on 1 Mar 2019
I = imread('crack_crop.jpeg') ;
I = rgb2gray(I) ;
[y,x] = find(I==0) ;
imshow(I)
hold on
plot(x,y,'.r')
%% GEt bounding box
x0 = min(x) ; x1 = max(x) ;
y0 = min(y) ; y1 = max(y) ;
%
B = x1-x0 ;
L = y1-y0 ;
R = [x0 y0 ; x0 y1 ; x1 y1 ; x1 y0] ;
% patch(R(:,1),R(:,2),'b')
if L>B
title('Vertical Crack')
else
title('Horizonatal Crack')
end

  5 Comments

Show 2 older comments
Ajaree Rattanaharn
Ajaree Rattanaharn on 28 Feb 2019
if possible, I want to specific the crack.
as the image above, it's a vertical break .

Sign in to comment.

More Answers (0)

Sign in to answer this question.