'Opencv ellipse() bug?
cv.ellipse( img, center, axes, angle, startAngle, endAngle, color[, thickness[, lineType[, shift]]] )
The startAngle
is the starting angle of the elliptic arc in degrees.If we set angele=30
and startAngle=60
,the angle of the starting line of the ellipse may be 30+60=90.Is that right?
But this is not the case.
My code:
img2 = np.zeros((500, 500))
img2 = cv2.ellipse(img2, (250, 250), (120, 40), 30, 60, 180, 255, -1)
cv2.imshow('2', img2)
cv2.waitKey(0)
Lets look at the result, the angle of the starting line(red line) is obviously not 90 degrees.
Why?Is it a bug?
Solution 1:[1]
I got it.
startAngle
is not the starting angle based on the ellpise.It is based on the circumcircle of that ellipse.Lets look at the following figure
It does a mapping operation.The blue curve is the output.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jeru Luke |