MCPcopy
hub / github.com/fudan-generative-vision/champ / mask_to_bkgd

Function mask_to_bkgd

datasets/data_utils.py:67–75  ·  view source on GitHub ↗
(img_path, mask_path)

Source from the content-addressed store, hash-verified

65 return xmin, ymin, xmax, ymax
66
67def mask_to_bkgd(img_path, mask_path):
68 img = Image.open(img_path)
69 img_array = np.array(img)
70
71 mask = Image.open(mask_path).convert("RGB")
72 mask_array = np.array(mask)
73
74 img_array = np.where(mask_array > 0, img_array, 0)
75 return Image.fromarray(img_array)
76

Callers 4

validateFunction · 0.90
validateFunction · 0.90
__getitem__Method · 0.90
__getitem__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected