我正在使用opencv和C ++读取JPG文件的文件夹,并将其作为PNG文件写入另一个文件夹。这是简单的示例:
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <string>
#include <iostream>
#include <fstream>
#include <filesystem>
using namespace cv;
using namespace std;
namespace fs = std::filesystem;
int main(){
for (auto& p : fs::recursive_directory_iterator("C:/Users/steve/Project/roof-big-data/labeled3/ALL")) {
cout << p.path()<<endl;
imread(p.path().string());
}
}
我正在使用MSVC 2019生成此代码,但正如任务管理器中所示,它仅占用我25%的CPU。是否可以强迫所有内核都使用未读内容?