Skip to content

Instantly share code, notes, and snippets.

View senemaktas's full-sized avatar
🎯
Focusing

senemaktas senemaktas

🎯
Focusing
View GitHub Profile
@senemaktas
senemaktas / yolo_to_cv2_and_cv2_to_yolo.py
Created July 7, 2022 07:41
yolo_to_cv2 and cv2_to_yolo
def yolo_to_cv2(x, y, w, h, dh, dw):
xmin = int((x - w / 2) * dw)
xmax = int((x + w / 2) * dw)
ymin = int((y - h / 2) * dh)
ymax = int((y + h / 2) * dh)
if xmin < 0:
xmin = 0
if xmax > dw - 1:
xmax = dw - 1