MCPcopy Create free account
hub / github.com/Atrovast/THGS / pad_img

Function pad_img

scripts/image_encoding.py:201–209  ·  view source on GitHub ↗
(img)

Source from the content-addressed store, hash-verified

199 return seg_img
200
201def pad_img(img):
202 h, w, _ = img.shape
203 l = max(w,h)
204 pad = np.zeros((l,l,3), dtype=np.uint8)
205 if h > w:
206 pad[:,(h-w)//2:(h-w)//2 + w, :] = img
207 else:
208 pad[(w-h)//2:(w-h)//2 + h, :, :] = img
209 return pad
210
211def filter(keep: torch.Tensor, masks_result) -> None:
212 keep = keep.int().cpu().numpy()

Callers 1

mask2segmapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected