Hough transform is detecting strange lines.

3 ビュー (過去 30 日間)
Lucas Echeverz
Lucas Echeverz 2017 年 8 月 14 日
コメント済み: Lucas Echeverz 2017 年 8 月 15 日
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 on
max_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;
end
end
  2 件のコメント
Image Analyst
Image Analyst 2017 年 8 月 15 日
I don't see any substantive difference. in both cases, I see a tile with white marks and dark shadows due to texture. Where are the cracks?
Lucas Echeverz
Lucas Echeverz 2017 年 8 月 15 日
Thanks for your answer!
This is a crack for us:
In the next image you can see that is detecting some cracks that aren't for us:
The original image, whitout processing is the next one:
I zoomed in the 3 images so you can see easier.

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

採用された回答

Image Analyst
Image Analyst 2017 年 8 月 15 日
Do the so-called cracks always occur in the same locations? It almost looks like they are some kind of smear/smudge caused by some kind of wheels that are supposed to move the tile along some assembly line but "skidded" on the wet tile causing slippage and a change in texture.
I don't think I'd even use hough at all. Try using a texture filter like stdfilt() and then threshold it and look for blobs that are horizontal.
  3 件のコメント
Image Analyst
Image Analyst 2017 年 8 月 15 日
If we're done, can you "Accept this answer".
Lucas Echeverz
Lucas Echeverz 2017 年 8 月 15 日
Of course!! Sorry didn't know about it!!

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by