在OpenCv中读取一个文件夹中的多个图像(python) [英] Read Multiple images on a folder in OpenCv (python)

查看:694
本文介绍了在OpenCv中读取一个文件夹中的多个图像(python)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用opencv(python)读取同一文件夹中的多个图像.为此,我需要对imread函数使用for循环或while循环吗?如果是这样,怎么办?请帮助我...

I want to read multiple images on a same folder using opencv (python). To do that do I need to use for loop or while loop with imread funcion? If so, how? please help me...

我想将图像放入数组中,然后通过循环一次处理它们.

I want to get images into an array and then processed them one at a time through a loop.

推荐答案

import glob
import cv2

images = [cv2.imread(file) for file in glob.glob("path/to/files/*.png")]

这篇关于在OpenCv中读取一个文件夹中的多个图像(python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆