依旧没什么进展
#include<iostream>
#include"LuxandFaceSDK.h"
#include<opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <cmath>
#include <time.h>
using namespace std;
using namespace cv;
int main(int argc, char** argv)
{
if (FSDKE_OK != FSDK_ActivateLibrary("your code"))
{
exit(-1);
}
/* test code
HImage img1; //注意这里的声明是HImage
TFacePosition FacePosition;
FSDK_Initialize("");
FSDK_LoadImageFromFile(&img1, "The_man_who_changed_china.jpg"); // load file
FSDK_DetectFace(img1, &FacePosition);
printf("face position: %d %d %d", FacePosition.xc, FacePosition.yc, FacePosition.angle);
*/
VideoCapture cap("face.mpeg");
HImage temp;
TFacePosition FacePosition[2];
FSDK_Initialize("");
while (true)
{
clock_t t1 = clock();
int count = 0;
Mat img, gray;
cap.read(img);
cvtColor(img,gray, COLOR_BGR2GRAY);
equalizeHist(gray, gray);
imwrite("tmp.jpg", gray);
FSDK_LoadImageFromFile(&temp, "tmp.jpg");
FSDK_DetectMultipleFaces(temp,&count,FacePosition,1024);
// printf("face pos%d %d %d", FacePosition.xc, FacePosition.yc, FacePosition.w) ;
if (count)
{
for (int i=0;i < count;i++)
{
rectangle(img, Rect(FacePosition[i].xc -FacePosition[i].w/2 , FacePosition[i].yc-FacePosition[i].w/2, FacePosition[i].w, FacePosition[i].w), Scalar(255, 0, 0));
}
}
cout <<1 / ((clock() - t1) * 1.0 / CLOCKS_PER_SEC ) << endl;
imshow("233", img);
if (waitKey(10) == 27)
{
break;
}
}
destroyAllWindows();
return 0;
}
试了一下Luxandsdk,精度,速度都还可以,就是我的电脑不太可以.
cpp问题太多了,动不动就炸vs,搞了好几天才搞好。属实炸心态
翻了好久英文文档都没有找到视频流的导入,无奈只好绕个小弯子,弄个读写来实现转换,效率肯定是低了,但是!他能!跑了!!!
感觉,学东西还是差点味道。