(x, ph, pw=None)
| 4 | from rng import np_rng, py_rng |
| 5 | |
| 6 | def center_crop(x, ph, pw=None): |
| 7 | if pw is None: |
| 8 | pw = ph |
| 9 | h, w = x.shape[:2] |
| 10 | j = int(round((h - ph)/2.)) |
| 11 | i = int(round((w - pw)/2.)) |
| 12 | return x[j:j+ph, i:i+pw] |
| 13 | |
| 14 | def patch(x, ph, pw=None): |
| 15 | if pw is None: |