# Excluding Hough transform artifacts at 45 and -45 degrees

5 Ansichten (letzte 30 Tage)
KAE am 16 Sep. 2019
Kommentiert: Jordan Kennedy am 22 Okt. 2020
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 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Jordan Kennedy am 22 Okt. 2020
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');

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Michael Knetzger am 5 Dez. 2019
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:
Therefore your soultion is sufficient, if you insist on having the full angular range, you need to alter your edge detection.
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
KAE am 9 Dez. 2019
Very nice detective work, thanks. This must be a common occurance for line detection in raster images.

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Hough Transform finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by