Nikita Kit
Nikita Kit

Reputation: 115

How to convert Bounding Box coordinates to Yolo Coordinates with Python?

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

Answers (1)

Sanoronas
Sanoronas

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

Related Questions