38 lines
877 B
C++
38 lines
877 B
C++
// test_track.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
|
|
//
|
|
|
|
#include <iostream>
|
|
#include "dtracker.h"
|
|
|
|
int main()
|
|
{
|
|
DTracker dt;
|
|
dt.init(R"(E:\workspace\DeepCamFaceSDK2.0\algorithm_module)");
|
|
|
|
cv::VideoCapture camera1(0);
|
|
if (!camera1.isOpened())
|
|
return 1;
|
|
int count = 0;
|
|
|
|
std::vector<TrackerBox> tbox;
|
|
while (true)
|
|
{
|
|
cv::Mat img;
|
|
camera1 >> img;
|
|
if (count++ % 5 == 0) {
|
|
tbox = dt.track(img);
|
|
};
|
|
|
|
|
|
for (auto& b : tbox)
|
|
{
|
|
cv::rectangle(img, b.tbox, cv::Scalar(0,0,255), 1);
|
|
cv::putText(img, std::string("ID:") + std::to_string(b.ID), cv::Point(b.tbox.x, b.tbox.y - 40), 2, 1, cv::Scalar(0, 0, 255));
|
|
cv::putText(img, std::string("qua:") + std::to_string(b.quality), cv::Point(b.tbox.x, b.tbox.y - 10), 2, 1, cv::Scalar(0, 0, 255));
|
|
}
|
|
cv::imshow("frame", img);
|
|
cv::waitKey(1);
|
|
|
|
}
|
|
}
|