1 Star 0 Fork 0

Jsdi/Face-Tracking-Using-CNN-and-Optical-Flow

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
demo.cpp 1.03 KB
一键复制 编辑 原始数据 按行查看 历史
Hans Ren 提交于 7年前 . Add files via upload
#include <opencv2/opencv.hpp>
#include "ncnn_mtcnn_tld_so.hpp"
#include <stdio.h>
using namespace cv;
using namespace std;
int main(){
cv::VideoCapture capture(0);
capture.set(CV_CAP_PROP_FRAME_WIDTH,320);
capture.set(CV_CAP_PROP_FRAME_HEIGHT,240);
if (!capture.isOpened()) return -1;
cv::Mat frame;
faceTrack tracker;
std::string modelPath="./models";
int minFace = 40;
tracker.Init(modelPath, minFace);
// std::string savePath = "./saved_2.avi";
// cv::VideoWriter outputVideo;
// outputVideo.open(savePath, CV_FOURCC('M', 'P', '4', '2'), 25.0, cv::Size(320,240));
while (capture.read(frame)) {
int q = cv::waitKey(1);
if (q == 27) break;
cv::Rect result;
double t1 = (double)getTickCount();
tracker.DetectFace(result, frame);
printf("total %gms\n", ((double)getTickCount()-t1)*1000/getTickFrequency());
printf("------------------\n");
rectangle(frame,result,Scalar(0,0,255), 2);
imshow("frame", frame);
// outputVideo << frame;
}
// outputVideo.release();
capture.release();
cv::destroyAllWindows();
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/MayuyuzZ/Face-Tracking-Using-CNN-and-Optical-Flow.git
git@gitee.com:MayuyuzZ/Face-Tracking-Using-CNN-and-Optical-Flow.git
MayuyuzZ
Face-Tracking-Using-CNN-and-Optical-Flow
Face-Tracking-Using-CNN-and-Optical-Flow
master

搜索帮助