Answers for "how to convert yolo format annotation t nomrla PYTHON"

0

how to convert yolo format annotation t nomrla PYTHON

dh,dw,_ = img.shape


f = open('image_100.txt','r')
data = f.readline()
f.close()

data = data.split(' ')

x_cen = float(data[1])
y_cen = float(data[2])
w = float(data[3])
h = float(data[4].replace('\n', ''))

left = int((x_cen - (w / 2)) * dw)
right = int((x_cen + (w / 2)) * dw)
top = int((y_cen - (h / 2)) * dh)
bottom = int((y_cen + (h / 2)) * dh)

cv2.rectangle(img, (left,top),(right,bottom), (0,255,0))
Posted by: Guest on July-30-2021

Python Answers by Framework

Browse Popular Code Answers by Language