Split the image into a grid.
(image, h, w)
| 86 | |
| 87 | |
| 88 | def 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 | |
| 103 | def grid_merge(grid, padding=(0, 0), pad_value=(0, 0)): |
nothing calls this directly
no outgoing calls
no test coverage detected