seetaface2在vs2015中的配置问题
本文仅供备忘作用。
在seetaface2的配置中,用Cmake编译不了,于是想到直接将seeta2中的头文件加进opencv的include目录下,将seeta2的库文件直接加进bin和lib目录下,最后直接在VS2015中通过添加“附加依赖项”,就可以使用seeta2了。
下载seeta2![下载seeta2](https://img-blog.csdnimg.cn/20191112152303889.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQxODEwOTkx,size_16,color_FFFFFF,t_70)
将【seeta】整个文件夹复制粘贴到opencv的include目录下
把dll文件放进opencv的bin目录下,把lib文件放进opencv的lib文件夹中
最后在VS2015中,把几个lib文件加进【附加依赖项】中去
放上一个人脸检测程序
#include<iostream>
#include <opencv2/opencv.hpp>
#include <seeta/FaceDetector2.h>
#include <seeta/Struct_cv.h>
#include <seeta/PointDetector2.h>
#include <seeta/FaceRecognizer.h>
//using namespace cv;
//人脸检测图像
int main()
{
//模型初始化
//这里把模型放进工程目录下
seeta::FaceDetector2 FD("SeetaFaceDetector2.0.ats");
//打开摄像头
cv::VideoCapture videoCapture(0);
if (!videoCapture.isOpened()) {
return 0;
}
cv::Mat frame;
videoCapture >> frame;
while (cv::waitKey(1) != 'q') {
videoCapture >> frame;
if (frame.empty()) {
break;
}
//创建ImageData图像数据
seeta::cv::ImageData image = frame;
//人脸检测
int num; // save the number of detected faces
SeetaRect *face = FD.Detect(image, &num);
std::cout << "face detection::" << "width:" << image.width << " height:" << image.height << " num:" << num << std::endl;
//绘制人脸框并显示
for (int i = 0; i < num; i++, face++) {
cv::Rect face_box = cv::Rect((int)face->x, face->y, face->width, face->height);
cv::rectangle(frame, face_box, cv::Scalar(0, 0, 255), 2, 8, 0);
// std::cout << "Face(" << i << "): " << "(" << face_box.x << ", " << face_box.y << ", " << face_box.width << ", " << face_box.height << ")" << std::endl;
}
cv::putText(frame, "face detection::width:" + std::to_string(image.width) + " height:" + std::to_string(image.height) + " num:" + std::to_string(num), cv::Point(10, 20), 0.5, 0.5, cv::Scalar(0, 0, 255));
cv::imshow("face_detection", frame);
cv::waitKey(10);
}
cv::destroyAllWindows();
return 0;
}