20 개의 그림이있는 폴더가 있습니다. 폴더를 열고 모든 그림을 스캔하고 모든 그림에 대해 고유 한 행렬을 만들고 싶습니다.Python - 그림이있는 폴더 열기
어떻게하면됩니까?
from os import listdir
from PIL import Image as PImage
def loadImages(path):
# return array of images
imagesList = listdir(path)
loadedImages = []
for image in imagesList:
img = PImage.open(path + image)
loadedImages.append(img)
return loadedImages
path = open(r"C:\Users\yasmin\Desktop\weeds\type1",encoding='utf-8')
# your images in an array
imgs = loadImages(path)
for img in imgs:
# you can show every image
img.show()
https://docs.python.org/2/library/os.html https://pillow.readthedocs.io/en/4.3 .x/ –
아무 것도 시도해 보셨습니까? Google에 시도 했습니까? 몇 가지 코드를 공유하십시오. – planet260
@ planet260 수정됨 – Yasmin