aihot  2017-05-24 18:36:31  OpenCV |   查看评论   

  OpenCV 3.1之前的版本,在contrib目录下有提供遍历文件的函数,用起来比较方便。但是在最新的OpenCV 3.1版本给去除掉了。为了以后使用方便,这里将OpenCV 2.4.9中相关的函数给提取了出来,适合在Windows 64bits上使用。

 
directory.hpp:
  1. #ifndef FBC_CV_DIRECTORY_HPP_  
  2. #define FBC_CV_DIRECTORY_HPP_  
  3.   
  4. // reference: include/opencv2/contrib/contrib.hpp (2.4.9)  
  5.   
  6. #ifndef __cplusplus  
  7.     #error directory.hpp header must be compiled as C++  
  8. #endif  
  9.   
  10. #include <vector>  
  11. #include "core/fbcdef.hpp"  
  12.   
  13. namespace fbc {  
  14.   
  15. class FBC_EXPORTS Directory {  
  16. public:  
  17.     std::vector<std::string> GetListFiles(const std::string& path, const std::string & exten = "*"bool addPath = true);  
  18.     std::vector<std::string> GetListFilesR(const std::string& path, const std::string & exten = "*"bool addPath = true);  
  19.     std::vector<std::string> GetListFolders(const std::string& path, const std::string & exten = "*"bool addPath = true);  
  20. };  
  21.   
  22. }  
  23.   
  24. #endif // FBC_CV_DIRECTORY_HPP_  

 

除特别注明外,本站所有文章均为 赢咖4注册 原创,转载请注明出处来自OpenCV代码提取:遍历指定目录下指定文件的实现

留言与评论(共有 0 条评论)
   
验证码:
[lianlun]1[/lianlun]