Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. # 1024pixel to 32pixel. RESIZE
  2. import os
  3. import cv2
  4. import numpy as np
  5.  
  6. path='D://jpggg//' # jpg로 확장자명 바꿔서 저장해 둔 사진폴더
  7. file_list = os.listdir(path)
  8. image_list = np.array( [cv2.imread(path+str(k)) for k in file_list] )
  9.  
  10. try:
  11. os.mkdir("d:\\b\\test100_resize")
  12. except:
  13. 0
  14. path='D://jpggg//'
  15. file_list = os.listdir(path)
  16. for j , i in enumerate(file_list):
  17. img = cv2.imread(path+str(i))
  18. width, height = img.shape[:2]
  19. resize = cv2.resize(img, (int(width / 32), int(height / 32)), interpolation=cv2.INTER_CUBIC)
  20. #원하는게 32*32 라서. 1024/32=32
  21. cv2.imwrite("d:\\b\\test100_resize\\" + str(i) ,resize)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement