1

enter image description here

I don't know why opencv can't find out the lines using HoughLines, the result is follow,

enter image description here

But if I use another picture from the internet, enter image description here

voila. Any ideas?

4
  • 1
    your input image is very blurry. sort that out first! Commented May 9, 2016 at 7:59
  • 1. You should post your code 2. Go through the tutorial (the code is in C++, but there are python corresponding functions) docs.opencv.org/2.4/doc/tutorials/imgproc/imgtrans/hough_lines/… Commented May 9, 2016 at 9:14
  • 1
    you don't know why OpenCV does not find the lines because you blindly use things you don't understand. you put diesel in a petrol engine and wonder why it won't run... do yourself a favour and read a book on image processing or leave image processing to experts. I recommend "Digital Image Processing: An Algorithmic Introduction using Java" by Burger & Burge. Commented May 9, 2016 at 11:01
  • yeah, I'm really sorry about that. Just in such a ruch :(. I'll try to understand the underlying principles. Commented May 9, 2016 at 11:41

1 Answer 1

2

It seems that Hough detect the lines extremities. A gradient is probably computed during the process.

A solution would be to:

  1. Binarize the image
  2. Compute the black region skeleton
  3. Skeleton pruning
  4. Apply the Hough Transform.

Doing that, each line will be reduced to 1 pixel width.

[EDIT] Here is an example:

  1. The test image binarized
  2. The skeleton (simple thinning).
  3. The result (I skipped the pruning).
Sign up to request clarification or add additional context in comments.

3 Comments

I'd be interested in seeing an actual example of this!
Houghlines is very sensitive to different parameters. Try LineSegmentDetector.
I've just added an example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.