Skip to content

Commit

Permalink
fix center_x, center_y
Browse files Browse the repository at this point in the history
  • Loading branch information
sonhun99 committed Sep 22, 2023
1 parent 45def67 commit cf65829
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions detect_and_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ def draw_boxes(img, bbox, identities=None, categories=None, names=None, save_wit
txt_str = ""
if save_with_object_id:
txt_str += "%i %i %f %f %f %f %f %f" % (
id, cat, int(box[0])/img.shape[1], int(box[1])/img.shape[0] , int(box[2])/img.shape[1], int(box[3])/img.shape[0] ,int(box[0] + (box[2] * 0.5))/img.shape[1] ,
int(box[1] + (
box[3]* 0.5))/img.shape[0])
id,
cat,
int(box[0]) / img.shape[1],
int(box[1]) / img.shape[0],
int(box[2]) / img.shape[1],
int(box[3]) / img.shape[0],
int(box[0] + box[2]) * 0.5 / img.shape[1],
int(box[1] + box[3]) * 0.5 / img.shape[0],
)
txt_str += "\n"
with open(path + '.txt', 'a') as f:
f.write(txt_str)
Expand Down

0 comments on commit cf65829

Please sign in to comment.