其他分享
首页 > 其他分享> > 利用opencv遍历目录下的所有文件

利用opencv遍历目录下的所有文件

作者:互联网

#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/ml.hpp"
#include "opencv2/objdetect.hpp"

int main()
{
    std::vector<cv::String> filenames; // notice here that we are using the Opencv's embedded "String" class
    cv::String folder = "G:\\liu_projects\\Pytorch-UNet\\checkpoints"; // again we are using the Opencv's embedded "String" class

    cv::glob(folder, filenames); // new function that does the job ;-)

    for (size_t i = 0; i < filenames.size(); ++i)
    {
        std::cout << filenames[i] << std::endl;
    }
}

  

标签:遍历,String,hpp,filenames,opencv2,opencv,include,目录,size
来源: https://www.cnblogs.com/liutianrui1/p/13924414.html