Ask Your Question
0

Line detection as only one line

asked 2014-10-05 09:46:45 -0600

Peter55555 gravatar image

I have scanned papers with some quite straight lines. I'd like to get every line as a mathematical function. In openCV there is HoughLinesP that detect lines but it shows upper edge of my line and bottom edge of my line. The second problem is that there is usually few lines very close to themselves (because lines are not perfect). I need method that show me only one line the most closest to my scanned line.

What should I use?

edit retag flag offensive close merge delete

Comments

1

hi peter,

put your entire code here then easy to understand exactly what is goingon in code

Thank you,

it's gov...

govardhana padavala gravatar imagegovardhana padavala ( 2014-10-06 01:53:13 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
-1

answered 2014-10-05 11:17:32 -0600

aliavci gravatar image

updated 2014-10-06 10:09:59 -0600

  1. Make a new function to calculate the slope of a line by using the 2 points in a single line. You can do this with the y and x values of the line's points. Do this for every line.
  2. Use the gradient to separate between horizontal lines and vertical looking lines
  3. Find the end points of the line you want to draw by search end points by searching the end points of all the lines according to gradient and place where you might see that point.

An example for part 3 is when searching a horizontal line: Use gradient function to filter horizontal lines, then search the x values of all points to keep the lowest x and highest x only.

edit flag offensive delete link more

Comments

This made it even more unclear to me ...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-06 06:15:52 -0600 )edit

Question Tools

Stats

Asked: 2014-10-05 09:46:45 -0600

Seen: 507 times

Last updated: Oct 06 '14