Ask Your Question

i need code to pass a line at the centre center of two curved lines

asked 2015-03-18 12:22:20 -0500


I have a two curved lines that runs parallel to each other. Now i need to find the exact centre between curved lines at the centre i need to pass an one more line that follows the other two curved lines

edit retag flag offensive close merge delete


Do you know the points of the Two Curves?

Balaji R gravatar imageBalaji R ( 2015-03-19 00:26:23 -0500 )edit

Refer to for finding edges of arc, organize coordinates forming arc in a vector either clock wise or anticlockwise order.. find mid value of vector, which would be the center of arc.

Spark gravatar imageSpark ( 2015-03-19 00:39:21 -0500 )edit

@creative, mark answers if it was helpful

Spark gravatar imageSpark ( 2015-03-23 05:46:07 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-03-23 01:03:22 -0500

Spark gravatar image

Assuming you have two curved lines running parallel to each other in your image, here is a suggestion to get the mid point between curved line.

  1. Threshold the image
  2. Find contour and its bounding rectangle for each curved line's contour.
  3. Get angle of its bounding rectangle.
  4. Bounding rectangle of both curved line must be same as it is parallel to each other. If the angle of bounding rect is 0 deg or 90 deg, subtract x coordinate of contour to get the mid point between parallel lines. If the angle of bounding rect is other than 0 deg or 90 deg, subtract y coordinate of contour.

Share your results with image samples.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-03-18 12:22:20 -0500

Seen: 128 times

Last updated: Mar 23 '15