Reputation: 1939
On line 151 in this program it draws an ellipse:
ellipse( image, trackBox, Scalar(0,0,255), 3, CV_AA );
How do I figure the center coordinate of the ellipse that was drawn after line 151?
According to this page an ellipse has a "center" property but I cannot figure out how to access it.
Would appreciate if someone can guide me how to get this center property.
Upvotes: 2
Views: 3435
Reputation: 2176
Have you tried to check docs?
Ellipse is drawn with RotatedRect as you see in code. Here you have it: http://docs.opencv.org/modules/core/doc/basic_structures.html?highlight=rotatedrect#RotatedRect
RotatedRect has center. So just yourRectName.center
Upvotes: 2
Reputation: 1456
the "trackBox" in the code is
RotatedRect
class object type. So you can access the center co ordinates by the following way
trackBox.center.x
trackBox.center.y
Add the following line of code after the line number 151 and see the center for visualization
ellipse( image, trackBox, Scalar(0,0,255), 3, CV_AA );
circle(image,trackBox.center,5,Scalar(0,255,0));
Upvotes: 3