Browse Source

Add files via upload

tags/v1.0.0
Alexey Mikhailyuk 3 years ago
parent
commit
2d6c45b939
No account linked to committer's email address
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      test.py

+ 4
- 2
test.py View File

@@ -12,12 +12,14 @@ coordinates = []
with open(args.txt, "r") as lines:
for line in lines:
hT, wT, cT = frame.shape
coordinates = line[2:].rstrip('\n').split(' ')
x1, y1,w2,h2 = float(coordinates[0]), float(coordinates[1]), float(coordinates[2]), float(coordinates[3])
coordinates = line.rstrip('\n').split(' ')
idx = coordinates[0]
x1, y1,w2,h2 = float(coordinates[1]), float(coordinates[2]), float(coordinates[3]), float(coordinates[4])
print(x1,y1,w2,h2)
w, h = int(w2 * wT), int(h2 * hT)
x, y = int((x1 * wT) - w / 2), int((y1 * hT) - h / 2)
# # 0 1 2 3 x1 - центр по x в процентах y1- центр по y в процентах w1- центр по w в процентах h1- центр по h в процентах
cv2.rectangle(frame, (x,y), (x+w, y+h), (0,255,255))
cv2.putText(frame,str(idx), (x, y-10), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (128, 0, 255), 2)
cv2.imshow("f", frame)
cv2.waitKey(0)

Loading…
Cancel
Save