我就是这样用C++加载图片的
程序员文章站
2022-03-08 20:34:52
...
#include <opencv2/opencv.hpp>
#include
#include
#include
#include
using namespace cv;
using namespace std;
int main() {
std::string pattern_jpg = “D:\Photo and Video\destop1\*.jpg”;
std::vector<cv::String> image_files;
cv::glob(pattern_jpg, image_files);
if (image_files.size() == 0) {
std::cout << "No image files[jpg]" << std::endl;
return 0;
}
for (unsigned int frame = 0; frame < image_files.size(); ++frame) {//image_file.size()代表文件中总共的图片个数
Mat image = cv::imread(image_files[frame]);
imshow("1", image);
waitKey(30);
}
推荐阅读