Auto align an image using Hough Transform
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Antworten (1)
Pavel Dey
am 21 Jan. 2016
Bearbeitet: Pavel Dey
am 21 Jan. 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.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!