Excluding Hough transform artifacts at 45 and -45 degrees

조회 수: 7 (최근 30일)
KAE
KAE 2019년 9월 16일
댓글: Jordan Kennedy 2020년 10월 22일
I am following steps in this example to find lines in my image, which contains a lot of nearly-horizontal lines. The Hough transform identifies several lines correctly, but there are additional incorrect lines at exactly 45 and -45 degrees, making an 'X' in my square image. I think these are a mathematical artifact (see Samuel Liew's answer here), and I would like to exclude them. The following works, but is there a better way? Or if you understand this artifact, could you please explain it?
angleList = -90:89; % All the permissable angles (note 90 can't be included)
angleList(angleList==45 | angleList==-45) = []; % Remove problematic -45, 45 degree angles
[H,T,R] = hough(BW, 'Theta', angleList);
  댓글 수: 1
Jordan Kennedy
Jordan Kennedy 2020년 10월 22일
In my dataset, I have true 45 degree artificats that are falsly amplified by the 45 degree angle artificat. So I did not want to remove 45 entirely. I still needed to maintain the true signal. With Michael Knetzger's explaination for the error I decided to use a 1D median filter on the H output of the Hough Transform. This is apart of the Signal Processing Toolbox. This seemed to work well for me.
tempangle = medfilt1(H,10,'truncate');

댓글을 달려면 로그인하십시오.

채택된 답변

Michael Knetzger
Michael Knetzger 2019년 12월 5일
Dear KAE,
since I had also issues with the 45 degree artifacts and your idea helped me I'll give you an explanation on how I see those artifacts.
You're following the examples in the documentation, so at one point you have am edge detected image. Although the lines have a preferred direction, the pixels are discret. So every step of your line from a horrizontal (or vertical) direction in order to form an inclined line is your 45 degree artifact.
So what you detect is this:
hough4matlab.png
Therefore your soultion is sufficient, if you insist on having the full angular range, you need to alter your edge detection.
  댓글 수: 1
KAE
KAE 2019년 12월 9일
Very nice detective work, thanks. This must be a common occurance for line detection in raster images.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by