识别效果
控制台主程序:
#include "Detection.h"
#include <iostream>
using namespace std;
using namespace cv;
using namespace dnn;
void TestDetection()
{
std::vector<cv::String> files;
glob("./data", files);
for (size_t i = 0; i < files.size(); i++)
{
Mat img = imread(files[i]);
cout << "width: " << img.cols << endl;
cout << "height: " << img.rows << endl;
Detection detection = Detection();
detection.Initialize(img.cols, img.rows);
detection.Detecting(img);
string save_path = files[i].substr(0, files[i].rfind(".")) + "result.jpg";
imwrite(save_path, detection.GetFrame());
//detection.~Detection();
}
//waitKey();
return;
//string image_path = "./data/1.bmp";
//string save_path = "./data/1.jpg";
//string image_path = "./data/test.jpg";
//string save_path = "./data/testresult.jpg";
//Mat img = imread(image_path);
//cout << "width: " << img.cols << endl;
//cout << "height: " << img.rows << endl;
/*Detection detection = Detection();
detection.Initialize(img.cols, img.rows);
detection.Detecting(img);
imwrite(save_path, detection.GetFrame());*/
//return;
}
int main()
{
TestDetection();
return 0;
}