麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

實(shí)時(shí)視頻人臉識別嘗試(使用ShiqiYu老師的人臉識別庫)

2019-11-11 04:58:51
字體:
供稿:網(wǎng)友
使用ShiqiYu老師的 face landmark detection方法進(jìn)行人臉識別與人臉轉(zhuǎn)動角度的計(jì)算,使用的是ShiqiYu老師在2017年1月更新的代碼。Github地址:https://github.com/ShiqiYu/libfacedetection其代碼較2015年的版本做了一些修改,其中提供了frontal,frontal-surveillance,multiview,multiview_reinforce四種方法。每種方法的耗費(fèi)時(shí)間與檢測的人臉轉(zhuǎn)向的范圍有所不同,在Github中對其效果差異做了詳細(xì)說明。使用multiview_reinforce為例進(jìn)行編寫,此次改動在調(diào)用函數(shù)中做了參數(shù)的修改需要注意。各個(gè)參數(shù)的含義如下:FACEDETECTDLL_API int * facedetect_multiview_reinforce(unsigned char * result_buffer, //buffer memory for storing face detection results, !!its size must be 0xC004 Bytes!!unsigned char * gray_image_data, int width, int height, int step, //input image, it must be gray (single-channel) image!float scale, //scale factor for scan windowsint min_neighbors, //how many neighbors each candidate rectangle should have to retain itint min_object_width, //Minimum possible face size. Faces smaller than that are ignored.int max_object_width = 0, //Maximum possible face size. Faces larger than that are ignored. It is the largest posible when max_object_width=0.int doLandmark = 0); // landmark detection在提供的example例子上進(jìn)行了修改,使用OpenCV接口讀取攝像頭的圖片,進(jìn)行實(shí)時(shí)操作。代碼如下:
//2017.2.6    #include <stdio.h>  #include <opencv2/opencv.hpp>  #include "facedetect-dll.h"    #PRagma comment(lib,"libfacedetect.lib")  //#pragma comment(lib,"libfacedetect-x64.lib")    //define the buffer size. Do not change the size!  #define DETECT_BUFFER_SIZE 0x20000  using namespace cv;    void OnMouseAction(int event, int x, int y, int falgs, void *ustc);  bool stime = false;    int main(int argc, char* argv[])  {    	Mat gray;  	Mat frame;  	Mat new_frame;  	int resize_height = 480;  	int resize_width = 640;    	int * pResults = NULL;         unsigned char * pBuffer = (unsigned char *)malloc(DETECT_BUFFER_SIZE);      if(!pBuffer)      {          fprintf(stderr, "Can not alloc buffer./n");          return -1;      }  	VideoCapture capture(0);    	while (stime==false)  	{  		capture >> frame;  		cv::resize(frame, new_frame, cv::Size(resize_width, resize_height), (0.0), (0.0), cv::INTER_LINEAR);  		cvtColor(new_frame, gray, CV_BGR2GRAY);  		int doLandmark = 1;    		pResults = facedetect_multiview_reinforce(pBuffer, (unsigned char*)(gray.ptr(0)), gray.cols, gray.rows, (int)gray.step,  			1.2f, 3, 24, 0, doLandmark);    		//printf("%d faces detected./n", (pResults ? *pResults : 0));  		Mat result_multiview_reinforce = new_frame.clone();;  		//print the detection results  		for (int i = 0; i < (pResults ? *pResults : 0); i++)  		{  			short * p = ((short*)(pResults + 1)) + 142 * i;  			int x = p[0];  			int y = p[1];  			int w = p[2];  			int h = p[3];  			int neighbors = p[4];  			int angle = p[5];    			printf("face_rect=[%d, %d, %d, %d], neighbors=%d, angle=%d/n", x, y, w, h, neighbors, angle);  			rectangle(result_multiview_reinforce, Rect(x, y, w, h), Scalar(0, 255, 0), 2);  			if (doLandmark)  			{  				for (int j = 0; j < 68; j++)  					circle(result_multiview_reinforce, Point((int)p[6 + 2 * j], (int)p[6 + 2 * j + 1]), 1, Scalar(0, 255, 0));  			}  		}  		imshow("Results_multiview_reinforce", result_multiview_reinforce);  		waitKey(30);  		setMouseCallback("Results_multiview_reinforce",OnMouseAction);  	}      //release the buffer      free(pBuffer);    	return 0;  }    void OnMouseAction(int event, int x, int y, int falgs, void *ustc)  {  	if (event==CV_EVENT_LBUTTONDOWN)  	{  		stime = true;  	}   	else  	{  		stime = false;   	}  } 效果圖如下:評價(jià)一下性能的話,識別效果確實(shí)不錯(cuò)。不足點(diǎn)的話一是當(dāng)人臉有部分遮擋、低頭或仰頭時(shí)無法識別,因此更適合應(yīng)用于正面下人臉左右擺動識別,如各種身份確認(rèn)等領(lǐng)域。不是用在安防等領(lǐng)域的檢測跟蹤的應(yīng)用背景中。
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 操操操日日日干干干 | 亚洲国产成人一区二区 | 黄色大片大毛片 | 日韩欧美精品中文字幕 | a免费看 | 国产精品免费一区二区三区四区 | 免费的毛片 | sesee99 | 99国语露脸久久精品国产ktv | 国产18成人免费视频 | 成人午夜视频在线观看 | 精品中文字幕久久久久四十五十骆 | 精品久久久久久久久亚洲 | 美女在线视频一区二区 | 久久日韩在线 | 日本欧美一区二区三区在线播 | 欧美精品国产综合久久 | 国产精品久久久久国产精品三级 | 国产一区国产二区在线观看 | 国产精品久久久在线观看 | 免费高潮在线国 | 成人精品aaaa网站 | 日本一级黄色大片 | 成人偷拍片视频在线观看 | 亚洲成人午夜精品 | 亚洲福利在线观看视频 | 羞羞答答xxdd在线播放 | 久久精品国产精品亚洲 | 手机国产乱子伦精品视频 | 中国美女一级黄色大片 | 偷偷草网站 | 久久久久久久久淑女av国产精品 | 欧美性受xxxxxx黑人xyx性爽 | 欧美韩国一区 | 国产88久久久国产精品免费二区 | 羞羞草视频 | 视频一区二区不卡 | 久久精品观看 | 久久久久久久久久久一区 | 免费专区 - 91爱爱 | 精品国产乱码一区二区三区四区 |