(imgsPath = 'test_images/')
| 9 | import cv2 |
| 10 | |
| 11 | def resize(imgsPath = 'test_images/'): |
| 12 | imgs = os.listdir(imgsPath) |
| 13 | for index,imgName in enumerate(imgs): |
| 14 | imgPath = os.path.join(imgsPath,imgName) |
| 15 | print(imgPath) |
| 16 | img = cv2.imread(imgPath) |
| 17 | img = cv2.resize(img,(24,24),interpolation=cv2.INTER_CUBIC) |
| 18 | cv2.imwrite(os.path.join(imgsPath,imgName),img) |
| 19 | print('done......') |
| 20 | |
| 21 | if __name__ == '__main__': |
| 22 | resize() |