【opencv450-目标检测】coco数据集yolo4-tiny预训练模型加载测试

 

 

识别效果

控制台主程序:

#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;
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值