opencv-python 读取同一目录的多个文件

import os

#导入机器视觉的包

import cv2 as cv

imgs = []
# walk会返回3个参数,分别是路径,目录list,文件list
for path, lists, frame in os.walk(文件路径):
    for f in frame:

        #读取无中文路径图像(1代表三通道的彩色图)

        #img = cv.imread(path + "/" + f,1)
        #读取中文路径图像(1代表三通道的彩色图)
        img = cv.imdecode(np.fromfile(path + "/" + f, dtype=np.uint8), 1)
        imgs.append(img)

猜你喜欢

转载自blog.csdn.net/Como0413/article/details/87599989
今日推荐