前言

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

不过,笔者在opencv2.4.10版本中并没有找到相关的文件。

实现代码

directory.hpp:

#ifndef FBC_CV_DIRECTORY_HPP_
#define FBC_CV_DIRECTORY_HPP_

// reference: include/opencv2/contrib/contrib.hpp (2.4.9)

#ifndef __cplusplus
    #error directory.hpp header must be compiled as C++
#endif

#include <vector>
#include "core/fbcdef.hpp"

namespace fbc {

class FBC_EXPORTS Directory {
public:
    std::vector<std::string> GetListFiles(const std::string& path, const std::string & exten = "*", bool addPath = true);
    std::vector<std::string> GetListFilesR(const std::string& path, const std::string & exten = "*", bool addPath = true);
    std::vector<std::string> GetListFolders(const std::string& path, const std::string & exten = "*", bool addPath = true);
};

}

#endif // FBC_CV_DIRECTORY_HPP_
View Code

相关文章:

  • 2022-12-23
  • 2021-06-11
  • 2022-12-23
  • 2022-12-23
  • 2021-04-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-28
  • 2022-12-23
  • 2021-09-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案