(image, max_resolution=512 * 512, resize_short_edge=None)
| 58 | |
| 59 | |
| 60 | def 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 | |
| 73 | def setup_dist(args): |
nothing calls this directly
no outgoing calls
no test coverage detected