imgs: list, N images of size WxHxC
(imgs, img_path)
| 110 | |
| 111 | |
| 112 | def imssave(imgs, img_path): |
| 113 | """ |
| 114 | imgs: list, N images of size WxHxC |
| 115 | """ |
| 116 | img_name, ext = os.path.splitext(os.path.basename(img_path)) |
| 117 | |
| 118 | for i, img in enumerate(imgs): |
| 119 | if img.ndim == 3: |
| 120 | img = img[:, :, [2, 1, 0]] |
| 121 | new_path = os.path.join(os.path.dirname(img_path), img_name+str('_s{:04d}'.format(i))+'.png') |
| 122 | cv2.imwrite(new_path, img) |
| 123 | |
| 124 | |
| 125 | def split_imageset(original_dataroot, taget_dataroot, n_channels=3, p_size=800, p_overlap=96, p_max=1000): |