Borrar filtros
Borrar filtros

Auto align an image using Hough Transform

1 visualización (últimos 30 días)
Jason
Jason el 15 de En. de 2016
Editada: Pavel Dey el 21 de En. de 2016
I have an image that is slightly misaligned. I thought the Hough transform would be relevant to aligning it.
But the answer is coming out to be 32 degrees which is wrong. Heres my code:
BW2 = edge(ROI,'canny');
figure(),imshow(BW2);
% Perform the Hough transform
[H, theta, rho] = hough(BW2);
% Find the peak pt in the Hough transform
peak = houghpeaks(H);
% Find the angle of the bars
barAngle = theta(peak(2));
title (num2str(barAngle))
Thanks for any help Jason

Respuestas (1)

Pavel Dey
Pavel Dey el 21 de En. de 2016
Editada: Pavel Dey el 21 de En. de 2016
I would like to know how are you verifying the result? Have you written another code to get the output? In that case I would suggest you to do the same check with one of the example image given in the documentation page.
See if the results are matching for the given example. If the difference is still there then check the following things,
1) How large is the difference? 2) Make sure that your reference for measuring the angle is same as the MATLAB. See the algorithm part of the doc link for Hough Transform
Hope that helps.
  1 comentario
Jason
Jason el 21 de En. de 2016
Thanks for replying...I had given up as no responses!!
Its clear to see that the red line is not at 32 degrees with respect to the horizontal.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by