Hi all, We are trying to find cracks on tiles. We could accomplish that on the expected tile. However, when we tried to do that on a tile that doesn’t have a crack, it detected unexpected lines. We couldn’t figure out what is going on. This is ok:
This is not ok:
Is there a way to erase that detected lines? Does it all depend on Canny value? Here is attached the code used:
J = histeq(B);figure, imshow(J), title('Histogram'); bw = edge(J, 'canny', 0.8);figure, imshow(bw), title('canny'); bw2 = imdilate(bw,strel('line',1,0));[H,T,R] = hough(figure;imshow(H,[],'XData',T,'YData',R,... 'InitialMagnification','fit'); xlabel('\theta'), ylabel('\rho');axis on, axis normal, hold on; P = houghpeaks(H,5,'threshold',ceil(0.3*max(H(:))));x = T(P(:,2)); y = R(P(:,1));plot(x,y,'s','color','white'); lines = houghlines(bw2,T,R,P,'FillGap',30,'MinLength',15);figure, imshow(A), hold onmax_len = 0;for k = 1:length(lines) xy = [lines(k).point1; lines(k).point2]; plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','White'); len = norm(lines(k).point1 - lines(k).point2); if ( len > max_len) max_len = len; xy_long = xy; endend
Best Answer