Find longevity of contours in opencv -
i want detect small straight lines in noisy image.
- find contours in image, - fit ellipse on - , height width ratio. - if ratio exceeds threshold, declare line segment.
this method works fine of time. in cases (according documentation, when contours self-intersect), fitellipse gives wrong results. there other method, can determine longevity of contours? not intend use hough lines.
one way grow line contour points track pixels on contour while checking line straightness. @ each new pixel estimate longest distance covered contour , line connecting contour's beginning , current contour point. when distance exceeds threshold stop growing line. in picture below, line red, contour black , distance green.
in case (since aren't growing line) need connect 2 contour terminals , scan contour distances line , select largest one. compare threshold decide on linearity of segment.
here how find distance point x, y line ax+by+c=0 or line defined 2 points in case: link
Comments
Post a Comment