MCPcopy Create free account
hub / github.com/Newmu/dcgan_code / center_crop

Function center_crop

lib/data_utils.py:6–12  ·  view source on GitHub ↗
(x, ph, pw=None)

Source from the content-addressed store, hash-verified

4from rng import np_rng, py_rng
5
6def 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
14def patch(x, ph, pw=None):
15 if pw is None:

Callers 1

transformFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected