我目前正在使用OPENCV 3.1版本
我在使用imutils.imlist(dir)错误AttributeError时遇到了错误:模块'imutils‘没有属性'imlist’
请提出一些其他的属性,这些属性可以用来代替imlist,或者说明imlist的精确性。
发布于 2017-03-19 10:11:00
如果你完全跟随博客文章,你会意识到博主没有使用pip包imutils。他使用自己导入的自定义文件,自定义文件的名称是imutils,它存在于github上。
截至2017年3月19日,你正在寻找的职能是:
def imlist(path):
"""
The function imlist returns all the names of the files in
the directory path supplied as argument to the function.
"""
return [os.path.join(path, f) for f in os.listdir(path)]尽管如此,IIUC函数假定给定目录中的所有文件都是图像。相反,您使用的imutils包有一个自己的函数,称为list_images,它提供了类似的功能(它是递归的)。你可以这样使用它:
from imutils import paths
list(paths.list_images('/path/to/dir/containing/images'))https://stackoverflow.com/questions/42883887
复制相似问题