I'm implementing Hough-Radon transform in Matlab to detect some patterns (stright lines mostly). I've already implemented it, but the problem is that it also detects the "frame" as a line (see picture).
The code to implement this is basically:
[H,T,R] = hough(BW,'RhoResolution',0.6,'Theta',-90:0.5:89.5);
P = houghpeaks(H,20,'threshold', ceil(0.1*max(H(:))));
lines = houghlines(BW,T,R,P,'FillGap', 15,'MinLength',50);
Where lines is a struct composed by the fields:
- Starting point.
- Ending point.
- Angle Tetha
- Distance Rho
Is there anything I could do to get rid of the four frame lines?
Edit:
The original picture before perform the Hough transform is:
BW
? In any case, you can remove them fromP
because you know the parameters of these 4 lines. – Cris LuengoP
contains both angle and distance for each line. You can find out what angle and distance correspond to these lines and remove them. Why do you say the points are different each time? What points? In the Hough space? Is it random??? – Cris Luengo