MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / get_aug_mask

Function get_aug_mask

tools/preprocess/utils.py:33–51  ·  view source on GitHub ↗
(body_mask, w_len=10, h_len=20)

Source from the content-addressed store, hash-verified

31
32
33def get_aug_mask(body_mask, w_len=10, h_len=20):
34 body_bbox = get_mask_boxes(body_mask)
35 if body_bbox is None:
36 return body_mask
37
38 bbox_wh = body_bbox[2:4] - body_bbox[0:2]
39 w_slice = np.int32(bbox_wh[0] / w_len)
40 h_slice = np.int32(bbox_wh[1] / h_len)
41
42 for each_w in range(body_bbox[0], body_bbox[2], w_slice):
43 w_start = min(each_w, body_bbox[2])
44 w_end = min((each_w + w_slice), body_bbox[2])
45 for each_h in range(body_bbox[1], body_bbox[3], h_slice):
46 h_start = min(each_h, body_bbox[3])
47 h_end = min((each_h + h_slice), body_bbox[3])
48 if body_mask[h_start:h_end, w_start:w_end].sum() > 0:
49 body_mask[h_start:h_end, w_start:w_end] = 1
50
51 return body_mask
52
53
54def get_mask_body_img(img_copy, hand_mask, k=7, iterations=1):

Callers 1

__call__Method · 0.90

Calls 1

get_mask_boxesFunction · 0.85

Tested by

no test coverage detected