Reputation: 115
I need to convert the coordinates. I have this format <left> <top> <width> <height>
And I need x_center y_center width height
in this format. How can I do it?
Upvotes: 1
Views: 779
Reputation: 43
The center is just the middle of your bounding box. So just add half of the bounding box width or height to yout top-left coordinate. Width and height remain unchanged
x_center = left + width / 2
y_center = top + height / 2
Upvotes: 1