Skip to content

Commit

Permalink
Fix issue with instance name display by using polygon center for trac…
Browse files Browse the repository at this point in the history
…ked videos
  • Loading branch information
healthonrails committed Mar 6, 2024
1 parent d2b6e00 commit 927c881
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion annolid/annotation/labelme2csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def convert_json_to_csv(json_folder, csv_file=None):
class_score = 1.0

if len(bboxs) > 0:
cy, cx = polygon_center(points)
cx, cy = polygon_center(points)
x1, y1, x2, y2 = bboxs[0]
csv_writer.writerow(
[frame_number, x1, y1, x2, y2, cx, cy,
Expand Down
6 changes: 3 additions & 3 deletions annolid/postprocessing/glitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,9 @@ def left_right_interact(fn,
is_draw = is_draw # and (left_interact > 0 or right_interact > 0)

if not math.isnan(x1) and _frame_num == frame_number:
cx = int((x1 + x2) / 2)
cx = int((x1 + x2) / 2) if 'cx' not in bf else int(bf['cx'])
cy_glitter = int((glitter_y1 + glitter_y2) / 2)
cy = int((y1 + y2) / 2)
cy = int((y1 + y2) / 2) if 'cy' not in bf else int(bf['cy'])
_, color = draw.get_label_color(
_class)

Expand Down Expand Up @@ -510,7 +510,7 @@ def left_right_interact(fn,
color,
-1)
if _class in animal_names and 'zone' not in _class.lower():
mask_label = f"-{_class}{tracking_id}-{score*100:.2f}%" if len(
mask_label = f"-{_class}{tracking_id if tracking_id != 0 else ''}" if len(
bbox_info) < 10 else str(tracking_id)
cv2.putText(frame, mask_label,
(cx+3, cy+3), cv2.FONT_HERSHEY_SIMPLEX,
Expand Down

0 comments on commit 927c881

Please sign in to comment.