Showing
1 changed file
with
14 additions
and
0 deletions
color_to_grayscale.py
0 → 100644
| 1 | +import cv2 | ||
| 2 | +import os | ||
| 3 | +import numpy as np | ||
| 4 | +from PIL import Image | ||
| 5 | + | ||
| 6 | +path = 'C:\\Users\\sso07\\Desktop\\OSS term project\\frozen_character_grayscale\\겨울왕국 브루니' | ||
| 7 | +imagePaths = [os.path.join(path,file_name) for file_name in os.listdir(path)] | ||
| 8 | +count = 0 | ||
| 9 | +for imagePath in imagePaths: | ||
| 10 | + count += 1 | ||
| 11 | + img = Image.open(imagePath).convert('L') | ||
| 12 | + img_numpy = np.array(img, 'uint8') | ||
| 13 | + cv2.imwrite("C:\\Users\\sso07\\Desktop\\OSS term project\\frozen_character_grayscale\\흑백 브루니\\사진겨울왕국브루니" + str(count) + ".jpg", img_numpy) | ||
| 14 | +print("All Done") |
-
Please register or login to post a comment