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

Function crop_images

dzoedepth/data/preprocess.py:124–134  ·  view source on GitHub ↗

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

(*images: np.ndarray, crop_params: CropParams)

Source from the content-addressed store, hash-verified

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.
126
127 Args:
128 images: RGB or depth images, shape (H, W, 3) or (H, W).
129 crop_params: Crop parameters.
130
131 Returns:
132 Cropped images.
133 """
134 return tuple(crop_image(image, crop_params) for image in images)
135
136def crop_black_or_white_border(rgb_image, *other_images: np.ndarray, tolerance=0.1, cut_off=20, level_diff_threshold=5) -> Tuple[np.ndarray]:
137 """Crops the white and black border of the RGB and depth images.

Callers 1

Calls 1

crop_imageFunction · 0.85

Tested by

no test coverage detected