MCPcopy Create free account
hub / github.com/TencentARC/MotionCtrl / resize_numpy_image

Function resize_numpy_image

utils/utils.py:60–70  ·  view source on GitHub ↗
(image, max_resolution=512 * 512, resize_short_edge=None)

Source from the content-addressed store, hash-verified

58
59
60def resize_numpy_image(image, max_resolution=512 * 512, resize_short_edge=None):
61 h, w = image.shape[:2]
62 if resize_short_edge is not None:
63 k = resize_short_edge / min(h, w)
64 else:
65 k = max_resolution / (h * w)
66 k = k**0.5
67 h = int(np.round(h * k / 64)) * 64
68 w = int(np.round(w * k / 64)) * 64
69 image = cv2.resize(image, (w, h), interpolation=cv2.INTER_LANCZOS4)
70 return image
71
72
73def setup_dist(args):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected