opencv(一):Directory(遍历目录下的文件(夹))
来源:互联网 发布:conor maynard知乎 编辑:程序博客网 时间:2024/06/05 03:02
opencv 工具类 Directory
opencv2
提供了一个 Directory
工具类来帮助读取文件夹中的文件名,这还是挺方便的,因为 目前常用的 c++
版本并没有提供简单的文件名读取接口。这个工具类在contrib.hpp
下。
注意:opencv3. 把contrib库从默认库中拿出来,如果想用这个工具类的话,需要自己重新把contrib编译一下。
Directory
类包含三个静态函数,分别是:
static std::vector< std::string > GetListFiles (const std::string &path, const std::string &exten="*", bool addPath=true)
static std::vector< std::string > GetListFilesR (const std::string &path, const std::string &exten="*", bool addPath=true)
static std::vector< std::string > GetListFolders (const std::string &path, const std::string &exten="*", bool addPath=true)
static std::vector< std::string > GetListFiles (const std::string &path, const std::string &exten=”*”, bool addPath=true)
这个函数只获取指定目录下的文件, 不理会目录。
- path:
string
, 用于指定根目录 - exten:
string
,这个是个正则表达式,匹配的返回,否则不返回。 - addPath:
bool
,如果为true
,返回的文件名会带path
,如果为false
,返回的仅是文件名。
static std::vector< std::string > GetListFilesR (const std::string &path, const std::string &exten=”*”, bool addPath=true)
这个API比上面多了个R
,这个R
代表的recursive
的意思,就是碰到文件夹还是往里钻。
static std::vector< std::string > GetListFolders (const std::string &path, const std::string &exten=”*”, bool addPath=true)
这个API
就是获取指定文件夹下的 文件夹了。
阅读全文
0 0
- opencv(一):Directory(遍历目录下的文件(夹))
- opencv 目录文件遍历
- opencv 目录文件遍历
- java代码遍历目录下的所有文件(查找对应目录下的所有文件)
- opencv自带的目录文件遍历
- 遍历目录下的文件
- 遍历目录下的文件
- 遍历目录下的文件
- 遍历目录下所有文件(VC)
- 遍历目录,获取目录下的文件
- OpenCV代码提取:遍历指定目录下指定文件的实现
- opencv中遍历文件夹下的文件
- 遍历目录下的所有文件
- [积累]遍历目录下的全部文件
- MFC 遍历目录下的文件
- java 遍历目录下的文件
- VC 遍历指定目录下的文件
- 遍历一个目录下的所有文件
- js时间
- C语言实现顺序栈的基本操作
- 关于STEM教育
- 学习Vue的资源汇总
- Python Windows下环境安装
- opencv(一):Directory(遍历目录下的文件(夹))
- vxWorks系统中多核cpu的使能
- mysql半同步复制
- 分布式项目运用-Dubbo配置
- 利用反射实现mysql数据库sql查询 返回List<E>泛型(持久化)对象
- # 融云 集成会话列表加头布局
- spring jsp table 获取单个input字段值并传到后台 成功简例
- 【设计模式】Java设计模式之模板方法模式
- Python 包