Wanli commited on
Commit
fc71ef8
·
1 Parent(s): d6f4836

clip palm bbox to (w,h) (#182)

Browse files
models/handpose_estimation_mediapipe/mp_handpose.py CHANGED
@@ -54,8 +54,8 @@ class MPHandPose:
54
  center_palm_bbox - new_half_size,
55
  center_palm_bbox + new_half_size])
56
  palm_bbox = palm_bbox.astype(np.int32)
57
- palm_bbox[:, 0] = np.clip(palm_bbox[:, 0], 0, image.shape[0])
58
- palm_bbox[:, 1] = np.clip(palm_bbox[:, 1], 0, image.shape[1])
59
  # crop to the size of interest
60
  image = image[palm_bbox[0][1]:palm_bbox[1][1], palm_bbox[0][0]:palm_bbox[1][0], :]
61
  # pad to ensure conner pixels won't be cropped
 
54
  center_palm_bbox - new_half_size,
55
  center_palm_bbox + new_half_size])
56
  palm_bbox = palm_bbox.astype(np.int32)
57
+ palm_bbox[:, 0] = np.clip(palm_bbox[:, 0], 0, image.shape[1])
58
+ palm_bbox[:, 1] = np.clip(palm_bbox[:, 1], 0, image.shape[0])
59
  # crop to the size of interest
60
  image = image[palm_bbox[0][1]:palm_bbox[1][1], palm_bbox[0][0]:palm_bbox[1][0], :]
61
  # pad to ensure conner pixels won't be cropped