Ask Your Question
0

Get line values for cvHoughLines2

asked 2013-02-20 00:10:52 -0600

Oliv gravatar image

Is it possible to find line values for cvHoughLines2? By using only threshold, I get 150 to 6000 lines, depending on the input image. If I increase the threshold, I get reasonable number for the image for which I previously got 6000 lines, but in this case I get too few lines for the less contrasting image.

Is it possible to either:

  • get the line values?

  • get only specified number of strongest lines?

edit retag flag offensive close merge delete

Comments

I'm detecting a lattice-like shape consisting of 32 lines, but under different light conditions and the original object colours and contrast I get very high variations in the number of lines using constant threshold. During testing, 200 strongest lines do the work, but I can't use this function because the results are already postprocessed and information discarded. I want to know, if it is possible to get the accumulator matrix, or postprocess the matrix into lines in a different way. I'm interested in the CV_HOUGH_STANDARD version. (Editing question causes Internal server error...)

Oliv gravatar imageOliv ( 2013-02-25 04:03:25 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
0

answered 2013-03-04 03:51:22 -0600

Oliv gravatar image

cvHoughLines2 returns the lines sorted by the accumulator value descendingly, thus taking first lines of the returned array solves the problem, even though I don't get the accumulator values.

Thanks to this message: http://tech.groups.yahoo.com/group/OpenCV/message/55201

edit flag offensive delete link more
0

answered 2013-02-22 08:35:37 -0600

rics gravatar image

Your question is not completely clear I assume that with low threshold you got too much lines while not enough lines with high threshold.

I do not think that there is an automated optimal value for the threshold that will suit your needs. You have experiment with all the parameters of the function to get the result what you want. You may even try different methods of Hough (e.g. probabilistic). Here is a description on what the parameters mean (for an older OpenCV version and here for the latest). There are longer tutorials on the algorithm behind like this and this.

Anyway it is better to opt for larger number of lines because you could postprocess the result and leave out unwanted lines and merge groups of similar ones. With small number of lines you have not so much option.

edit flag offensive delete link more

Comments

I want the accumulator values. If I get 6000 lines, I'm not able to postprocess them, because lines cross the image all the way around. Iteratively adapting the threshold to get desired number of lines is just wasting CPU time.

Oliv gravatar imageOliv ( 2013-02-25 03:59:34 -0600 )edit

I suggested that you make your experiment once and use the resulting parameters from that time. No on-line search for parameters.

rics gravatar imagerics ( 2013-02-25 04:29:07 -0600 )edit

Question Tools

Stats

Asked: 2013-02-20 00:10:52 -0600

Seen: 1,340 times

Last updated: Mar 04 '13