Args: mask: [h, w] Returns:
(mask)
| 6 | |
| 7 | |
| 8 | def get_mask_boxes(mask): |
| 9 | """ |
| 10 | |
| 11 | Args: |
| 12 | mask: [h, w] |
| 13 | Returns: |
| 14 | |
| 15 | """ |
| 16 | y_coords, x_coords = np.nonzero(mask) |
| 17 | if x_coords.size == 0: |
| 18 | return None |
| 19 | x_min = x_coords.min() |
| 20 | x_max = x_coords.max() |
| 21 | y_min = y_coords.min() |
| 22 | y_max = y_coords.max() |
| 23 | bbox = np.array([x_min, y_min, x_max, y_max]).astype(np.int32) |
| 24 | return bbox |
| 25 | |
| 26 | |
| 27 | def skip_replace_frame_outputs(frame): |