(img_in, scale)
| 492 | |
| 493 | |
| 494 | def modcrop(img_in, scale): |
| 495 | # img_in: Numpy, HWC or HW |
| 496 | img = np.copy(img_in) |
| 497 | if img.ndim == 2: |
| 498 | H, W = img.shape |
| 499 | H_r, W_r = H % scale, W % scale |
| 500 | img = img[:H - H_r, :W - W_r] |
| 501 | elif img.ndim == 3: |
| 502 | H, W, C = img.shape |
| 503 | H_r, W_r = H % scale, W % scale |
| 504 | img = img[:H - H_r, :W - W_r, :] |
| 505 | else: |
| 506 | raise ValueError('Wrong img ndim: [{:d}].'.format(img.ndim)) |
| 507 | return img |
| 508 | |
| 509 | |
| 510 | def shave(img_in, border=0): |
nothing calls this directly
no outgoing calls
no test coverage detected