C++17/opencv code如下
#include <iostream>
#include <filesystem>
#include <opencv2/opencv.hpp>
#include <string>
using namespace std;
using namespace std::filesystem;
using namespace cv;
int main()
{
cout << "darknet基本CPU版植入 C++ filesysem,opencv圖檔辨識\n";
//考慮如何將下面命令列寫入C++程式
//darknet detector test cfg/openimages.data cfg/yolov3-openimages.cfg
//yolov3-openimages.weights D:/kanji/images/31.jpg >result.txt
current_path("D:\\vcpkg_cpu\\vcpkg\\installed\\x64-windows\\tools\\darknet");
string run = "darknet detector test cfg/openimages.data cfg/yolov3-openimages.cfg \
yolov3-openimages.weights D:/kanji/images/1.jpg >>result.txt";
string y4 = "darknet detector test cfg/coco.data cfg/yolov4.cfg yolov4.weights ";
for( auto& entry: directory_iterator("D:/kanji/images"))
{
string y5 = y4+entry.path().string() + " >>result_y4.txt ";
system(y5.c_str());
Mat im = imread("predictions.jpg");
imshow("predict", im);
waitKey(3000);
}
return 0;
}

沒有留言:
張貼留言
HTML 編輯器