Make a grid from images. w -- number of grid columns imgs -- images (must have same size and format)
(w, imgs)
| 209 | return output |
| 210 | |
| 211 | def mosaic(w, imgs): |
| 212 | '''Make a grid from images. |
| 213 | |
| 214 | w -- number of grid columns |
| 215 | imgs -- images (must have same size and format) |
| 216 | ''' |
| 217 | imgs = iter(imgs) |
| 218 | if PY3: |
| 219 | img0 = next(imgs) |
| 220 | else: |
| 221 | img0 = imgs.next() |
| 222 | pad = np.zeros_like(img0) |
| 223 | imgs = it.chain([img0], imgs) |
| 224 | rows = grouper(w, imgs, pad) |
| 225 | return np.vstack(map(np.hstack, rows)) |
| 226 | |
| 227 | def getsize(img): |
| 228 | h, w = img.shape[:2] |
no test coverage detected