(img_path)
| 7 | from IPython import embed |
| 8 | |
| 9 | def load_img(img_path): |
| 10 | out_np = np.asarray(Image.open(img_path)) |
| 11 | if(out_np.ndim==2): |
| 12 | out_np = np.tile(out_np[:,:,None],3) |
| 13 | return out_np |
| 14 | |
| 15 | def resize_img(img, HW=(256,256), resample=3): |
| 16 | return np.asarray(Image.fromarray(img).resize((HW[1],HW[0]), resample=resample)) |