c++实现情绪识别

在上一篇使用python实现情绪识别的基础上,使用c++实现情绪识别。

 

这里的人脸检测模块不是使用dlib模块(使用dlib模块也可以,测试以后发现速度比较慢),这里使用另外一个开源的模块。

facedetect-dll.h,可以去我的资源里下载。里面的眉毛斜率检测模块,因为c++没有np.polyfit,所以需要自己实现(参考最小二乘)。

 

 

#include <fstream>  
#include <string>  
#include <iostream>  
//#include <dlib/image_processing/frontal_face_detector.h>
//#include <dlib/image_processing/render_face_detections.h>
//#include <dlib/image_processing.h>
//#include <dlib/gui_widgets.h>
//#include <dlib/image_io.h>
#include <opencv2/core/core.hpp>  
//#include <dlib/timer.h>
#include <opencv2/dnn.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include "highgui.h"
#include "lib\facedetect-dll.h"
#include <iostream>
#include <cstdlib>
#include "lib\facedetect-dll.h"
using namespace cv;
using namespace std;
using namespace dnn;
float LineFitLeastSquares(float *data_x, float *data_y, int data_n);
// ----------------------------------------------------------------------------------------
//
#define DETECT_BUFFER_SIZE 0x20000
int main()
{


	const char* path = "E:/fangtu1/1/FTA001190217537664_一寸照.jpg";
	unsigned char * pBuffer = (unsigned char *)malloc(DETECT_BUFFER_SIZE);

	//auto src = cv::imread("C:/Users/01/Desktop/face/CNN_Face_Glass_Classfy-master/face7.jpg");
	auto src = cv::imread(path);
	Mat gray;
	cvtColor(src, gray, CV_BGR2GRAY);
	auto pResults = facedetect_multiview_reinforce(pBuffer, (un
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值