2
$\begingroup$

I have an image which includes straight borders which I need to detect: original The borders are thick, which causes hough transform to detect multiple lines for each border, as can be seen in the following image:hough transform result

In order to find the 'true' lines, I want to find all parallel lines (i.e. find the lines which converge into a vanishing point). Does OpenCV (or any other library for the sake of this manner) contains such a functionality? (I'm using python, though I can port c++ scripts as well)

Thanks in advance

$\endgroup$
  • $\begingroup$ So you want to find all the lines such that, if they continued outside the image shown, would intersect at the same two-dimensional point? $\endgroup$ – Tendero Jan 9 '18 at 14:19
  • $\begingroup$ For me to propose an algorithm for this please send an original image, on which I could work. And perpendicular in general means intersecting with 90 degree angle. Do you mean vanishing lines or parallel lines that intersect at infinity? $\endgroup$ – Tolga Birdal Jan 9 '18 at 14:26
  • $\begingroup$ @TolgaBirdal yes, my bad. I added the original image + changed to 'parallel' $\endgroup$ – Nissim Jan 9 '18 at 14:48
6
$\begingroup$

Parallel lines in the image do intersect at a vanishing point. Therefore simply hypothesizing lines (a gradient direction at a point suffices to describe it) and voting (see Hough voting) would suffice to identify this point. One could then record all the lines that casted votes to this very point and identify them. Care must be taken as it is difficult to vote directly on a vanishing point, i.e. the space is not bounded and explodes to infinity. Instead, it is possible to use a Gaussian Sphere as Barnard suggested.

Vanishing point extraction is a well studied topic and many algorithms exist, some of which are:

Finally, when multiple lines cause a problem, one could always cluster them using the line parameters $[a,b,c]$. When number of lines are not known, one can use a hierarchical clustering, such as single-linkage or agglomerative clustering.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.