lizarisk
lizarisk

Reputation: 7820

HoughLinesP with slightly distorted lines in OpenCV

I'm trying to detect horizontal and vertical lines in image by using HoughLinesP function in OpenCV. Initially I've set rho = 1, theta = CV_PI / 2 and minLineLength to the minimum expected line length.

But it turned out that my lines could occupy more that one line of pixels on the image: sometimes they could get shifted back and forth by one pixel due to some noise in the image (this is illustrated in the attachment). In this case the line becomes split into many shorter segments and therefore could not be detected.

I've tried to set rho = 2 to decrease the accumulator resolution, but it didn't solve the problem. It seems that the solution should be pretty easy, but I didn't figure it out yet. Could you suggest something?

shifted line

Upvotes: 0

Views: 396

Answers (1)

Semih Korkmaz
Semih Korkmaz

Reputation: 1145

Did you take a look at Line Segment Detector ? http://www.ipol.im/pub/art/2012/gjmr-lsd/

Upvotes: 1

Related Questions