MCPcopy Create free account
hub / github.com/RylonW/DocNLC / crop_border

Function crop_border

utils/util.py:97–109  ·  view source on GitHub ↗

Crop borders of images Args: img_list (list [Numpy]): HWC crop_border (int): crop border for each end of height and weight Returns: (list [Numpy]): cropped image list

(img_list, crop_border)

Source from the content-addressed store, hash-verified

95# image convert
96####################
97def crop_border(img_list, crop_border):
98 """Crop borders of images
99 Args:
100 img_list (list [Numpy]): HWC
101 crop_border (int): crop border for each end of height and weight
102
103 Returns:
104 (list [Numpy]): cropped image list
105 """
106 if crop_border == 0:
107 return img_list
108 else:
109 return [v[crop_border:-crop_border, crop_border:-crop_border] for v in img_list]
110
111
112def tensor2img(tensor, out_type=np.uint8, min_max=(0, 1)):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected