MCPcopy Create free account
hub / github.com/VisionXLab/OF-Diff / modcrop_np

Function modcrop_np

ldm/modules/image_degradation/bsrgan.py:29–39  ·  view source on GitHub ↗

Args: img: numpy image, WxH or WxHxC sf: scale factor Return: cropped image

(img, sf)

Source from the content-addressed store, hash-verified

27
28
29def modcrop_np(img, sf):
30 '''
31 Args:
32 img: numpy image, WxH or WxHxC
33 sf: scale factor
34 Return:
35 cropped image
36 '''
37 w, h = img.shape[:2]
38 im = np.copy(img)
39 return im[:w - w % sf, :h - h % sf, ...]
40
41
42"""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected