MCPcopy Create free account
hub / github.com/LynnHo/EigenGAN-Tensorflow / grid_split

Function grid_split

scripts/imlib/transform.py:88–100  ·  view source on GitHub ↗

Split the image into a grid.

(image, h, w)

Source from the content-addressed store, hash-verified

86
87
88def grid_split(image, h, w):
89 """Split the image into a grid."""
90 n_rows = math.ceil(image.shape[0] / h)
91 n_cols = math.ceil(image.shape[1] / w)
92
93 rows = []
94 for r in range(n_rows):
95 cols = []
96 for c in range(n_cols):
97 cols.append(image[r * h: (r + 1) * h, c * w: (c + 1) * w, ...])
98 rows.append(cols)
99
100 return rows
101
102
103def grid_merge(grid, padding=(0, 0), pad_value=(0, 0)):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected