Ask Your Question

samkhan's profile - activity

2020-11-16 14:55:50 -0600 received badge  Famous Question (source)
2018-04-28 09:19:20 -0600 received badge  Notable Question (source)
2017-04-10 09:28:29 -0600 received badge  Popular Question (source)
2015-12-27 13:31:54 -0600 received badge  Student (source)
2015-02-24 21:30:54 -0600 asked a question Draw lines from centroid of contour at given angle till edge of contour

I have a contour named 'cnt' obtained from the image below:

image description

for which I am able to find the centroid like this:

M = cv2.moments(cnt)
centroid_x = int(M['m10']/M['m00'])
centroid_y = int(M['m01']/M['m00'])

I now want to draw N number of lines, each 360/N degrees apart, starting from the centroid and passing through all possible points of intersection with the contour. The cv2.line() function requires start point and end point but I don't have the end point.

If I had drawn a line passing through centroid with a slope of Tan(360/N) I would have found the intersection of the line with the contour using bitwise_and but I'm not able to figure out a way to draw that line.

Any help would be much appreciated.

2015-02-24 19:50:21 -0600 received badge  Supporter (source)