(image, save_dir, name, n)
| 145 | |
| 146 | |
| 147 | def write_batch_image(image, save_dir, name, n): |
| 148 | |
| 149 | if not os.path.exists(save_dir): |
| 150 | os.makedirs(save_dir) |
| 151 | |
| 152 | fused_dir = os.path.join(save_dir, name) |
| 153 | fused_image = [0] * n |
| 154 | for i in range(n): |
| 155 | fused_image[i] = [] |
| 156 | for j in range(n): |
| 157 | k = i * n + j |
| 158 | image[k] = (image[k]+1) * 127.5 |
| 159 | #image[k] = image[k] - np.min(image[k]) |
| 160 | #image[k] = image[k]/np.max(image[k]) |
| 161 | #image[k] = image[k] * 255.0 |
| 162 | fused_image[i].append(image[k]) |
| 163 | fused_image[i] = np.hstack(fused_image[i]) |
| 164 | fused_image = np.vstack(fused_image) |
| 165 | cv2.imwrite(fused_dir, fused_image.astype(np.uint8)) |
| 166 | |
| 167 | |
| 168 | if __name__ == '__main__': |
nothing calls this directly
no outgoing calls
no test coverage detected