Split imprecise checkerboard pattern

2 visualizaciones (últimos 30 días)
Nassim Habbash
Nassim Habbash el 9 de Ag. de 2018
Comentada: Nassim Habbash el 21 de Ag. de 2018
I have a set of chessboard diagrams photos. I have managed to extract them and rotate them so they're mostly orthonormal. I now need to split the pictures according to the checkerboard pattern. The images aren't well-aligned, some are slightly angled or have slight distortions due to the transformation process, while other have a more noisy border due to the extraction process.
I have tried different ways to extract the lines with Hough's transform, first through an edge detection (Canny), after by scaling down the pic and trying to get a solid checkerboard pattern through morphological operations, but neither did bring to satisfying results. So far Edge detection + Hough has been the most successful, but still I manage to get at most 4 lines per image, while I'd need 14 to split the image.
This is the code I use for Hough:
imedge = edge(imgray,'Canny',[], 2);
[H,T,R] = hough(imedge, 'Theta',[-90:-87 -3:3 87:89]);
Here an example:
Edge + Hough
Scaling + Hough
Scaling + Edge + Hough

Respuesta aceptada

Naman Chaturvedi
Naman Chaturvedi el 13 de Ag. de 2018
Hi Nassim,
I tried finding the checkerboard lines and I could easily do it using edge+hough.
i1=imread('chess.png');
imedge = edge(i1,'Canny',[], 2);
[H,T,R] = hough(imedge,'Theta',[-90:-87 -3:3 87:89]);
P = houghpeaks(H,20);
lines = houghlines(imedge,T,R,P);
figure;
imshow(imedge);
hold on;
for k=1:length(lines)
xy=[lines(k).point1,lines(k).point2];
if abs(lines(k).theta)==90
plot([xy(2) xy(4)],[0 size(i,1)],'r');
else
plot([0 size(i,2)],[xy(1) xy(3)],'r');
end
end
You basically have to play with the number of 'houghpeaks' to be detected as some lines are detected multiple times. By further processing, you can remove the multiple lines.
Hope this helps.
  1 comentario
Nassim Habbash
Nassim Habbash el 21 de Ag. de 2018
Hello, thank you for your answer, you're exactly right!

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by