MCPcopy Create free account
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / crop_image

Function crop_image

dzoedepth/data/preprocess.py:112–122  ·  view source on GitHub ↗

Crops the image according to the crop parameters. Args: image: RGB or depth image, shape (H, W, 3) or (H, W). crop_params: Crop parameters. Returns: Cropped image.

(image: np.ndarray, crop_params: CropParams)

Source from the content-addressed store, hash-verified

110 return get_border_params(rgb_image, value=0, **kwargs)
111
112def crop_image(image: np.ndarray, crop_params: CropParams) -> np.ndarray:
113 """Crops the image according to the crop parameters.
114
115 Args:
116 image: RGB or depth image, shape (H, W, 3) or (H, W).
117 crop_params: Crop parameters.
118
119 Returns:
120 Cropped image.
121 """
122 return image[crop_params.top:crop_params.bottom, crop_params.left:crop_params.right]
123
124def crop_images(*images: np.ndarray, crop_params: CropParams) -> Tuple[np.ndarray]:
125 """Crops the images according to the crop parameters.

Callers 1

crop_imagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected