Skip to content

Commit

Permalink
mask: extend mask by 4 pixels on each side
Browse files Browse the repository at this point in the history
  • Loading branch information
Martijnsvb committed Jun 16, 2022
1 parent 9d10ddc commit 0e2b517
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ def yolo_to_pixel(yolo_x1, yolo_y1, yolo_x2, yolo_y2, img_width, img_height):
pixel_y1 = 0
if pixel_y2 > img_height - 1:
pixel_y2 = img_height - 1

# Extend the mask by 4 pixels on each side to account for small errors in detection
pixel_x1 -= 4
pixel_y1 -= 4
pixel_x2 += 4
pixel_y2 += 4

return (pixel_x1, pixel_y1), (pixel_x2, pixel_y2)

Expand Down

0 comments on commit 0e2b517

Please sign in to comment.