資源簡介
基于seetaface的android實現(xiàn),包含檢測、對齊、比對,采用NEON優(yōu)化提高處理速度,提高人臉旋轉(zhuǎn)角度roll,pitch,yaw,帶自動遍歷比對人臉

代碼片段和文件信息
#include?“CMImgProc.h“
#define?CV_DESCALE(xn)?(((x)?+?(1?<((n)?-?1)))?>>?(n))
//?雙線性插值圖像縮放注意:縮放只改變寬高不改變通道數(shù)
//?src 源圖像指針
//?swshsc 分別表示源圖像的寬高及通道數(shù)
//?dst 縮放后圖像指針
//?dwdh 縮放后圖像寬高
void?CMImgProc::ResizeLinear(unsigned?char?*src?int?sw?int?sh?int?sc?unsigned?char?*dst?int?dw?int?dh)
{
//LOGD(“native?ResizeLinear?1sw=%d?sh=%d?dw=%d?dh=%d“?sw?sh?dw?dh);
unsigned?char?*dataDst?=?dst;??
int?stepDst?=?dw?*?sc;
unsigned?char?*dataSrc?=?src;??
int?stepSrc?=?sw?*?sc;??
int?iWidthSrc?=?sw;??
int?iHiehgtSrc?=?sh;?
double?scale_x?=?(double)sw?/?dw;??
double?scale_y?=?(double)sh?/?dh;
//LOGD(“native?ResizeLinear?2?scale_x=%f?scale_y=%f“?scale_x?scale_y);
for?(int?j?=?0;?j? {??
float?fy?=?(float)((j?+?0.5)?*?scale_y?-?0.5);??
int?sy?=?(int)floor(fy);//?向下取整
fy?-=?sy;??
sy?=?std::min(sy?iHiehgtSrc?-?2);??
sy?=?std::max(0?sy);??
int?cbufy[2];??
cbufy[0]?=?(int)((1.f?-?fy)?*?2048?+?0.5);??
cbufy[1]?=?2048?-?cbufy[0];??
for?(int?i?=?0;?i? {??
float?fx?=?(float)((i?+?0.5)?*?scale_x?-?0.5);??
int?sx?=?(int)floor(fx);??
fx?-=?sx;??
if?(sx?0)?{??
fx?=?0?sx?=?0;??
}??
if?(sx?>=?iWidthSrc?-?1)?{??
fx?=?0?sx?=?iWidthSrc?-?2;??
}??
short?cbufx[2];??
cbufx[0]?=?(int)((1.f?-?fx)?*?2048?+?0.5);
cbufx[1]?=?2048?-?cbufx[0];??
//?對每個通道進(jìn)行計算
for?(int?k?=?0;?k? {??
*(dataDst+?j*stepDst?+?sc*i?+?k)?=?(*(dataSrc?+?sy*stepSrc?+?sc*sx?+?k)?*?cbufx[0]?*?cbufy[0]?+???
*(dataSrc?+?(sy+1)*stepSrc?+?sc*sx?+?k)?*?cbufx[0]?*?cbufy[1]?+???
*(dataSrc?+?sy*stepSrc?+?sc*(sx+1)?+?k)?*?cbufx[1]?*?cbufy[0]?+???
*(dataSrc?+?(sy+1)*stepSrc?+?sc*(sx+1)?+?k)?*?cbufx[1]?*?cbufy[1])?>>?22;??
}?
}??
}
}
/**
?*?RGBA的圖像轉(zhuǎn)為RGB圖像
?*/
void?CMImgProc::RGBA2RGB(const?unsigned?char?*src?unsigned?char?*dst?int?w?int?h)
{
//LOGD(“native?RGBA2GRAY?1......“);
const?unsigned?char?*pSrc;
unsigned?char?*pDst;
for(int?j?=?0;?j? {
pSrc?=?src?+?j?*?w?*?4;
pDst?=?dst?+?j?*?w?*?3;
for(int?i?=?0;?i? {
pDst[2]?=?pSrc[2];
pDst[1]?=?pSrc[1];
pDst[0]?=?pSrc[0];
pSrc?+=?4;
pDst?+=?3;
}
}
}
//?RGBA格式轉(zhuǎn)GRAY采用公式如下
//?Y?=?0.299?*?R?+?0.587?*?G?+?0.114?*?B
//?Cr?=?(R?-?Y)?*?0.713?+?delta
//?Cb?=?(B?-?Y)?*?0.564?+?delta
//?src 源數(shù)據(jù)4通道RGBA
//?dst 結(jié)果數(shù)據(jù)3通道YCrCb
//?w 圖像的寬度
//?h 圖像的高度
//?sc 源圖像的通道數(shù)一般為4
void?CMImgProc::RGBA2GRAY(const?unsigned?char?*src?unsigned?char?*dst?int?w?int?h?int?sc)
{
LOGD(“native?RGBA2GRAY?1......“);
static?int?yuv_shift?=?14;
static?int?c0?=?4899c1?=?9617c2?=?1868;//RGB
size_t?len?=?strlen((char*)src);
size_t?t_sc?=?len/(w*h);
LOGD(“native?RGBA2GRAY?2.....len=%d?w=%d?h=%d?sc=%d?t_sc=%d“?len?w?h?sc?t_sc);
const?unsigned?char?*pSrc;
unsigned?char?*pDst;
for(int?j?=?0;?j? {
pSrc?=?src?+?j?*?w?*?sc;
pDst?=?dst?+?j?*
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????I.A....??????1182??2016-11-30?07:04??.project
????I.A....??????1115??2016-11-30?07:04??AndroidManifest.xm
????I.A....???????781??2016-11-30?07:04??proguard-project.txt
????I.A....???????563??2016-11-30?07:04??project.properties
????I.A....??????2117??2016-11-30?07:03??jni\Android.mk
????I.A....???????400??2016-12-03?01:43??jni\Application.mk
????I.A....??????6752??2016-12-03?06:43??jni\CMImgProc.cpp
????I.A....??????1073??2016-11-30?07:03??jni\CMImgProc.h
????I.A....?????14246??2016-11-30?07:03??jni\FaceAlignment\cfan.cpp
????I.A....??????3124??2016-11-30?07:03??jni\FaceAlignment\face_alignment.cpp
????I.A....??????4697??2016-11-30?07:03??jni\FaceAlignment\include\cfan.h
????I.A....??????2735??2016-11-30?07:03??jni\FaceAlignment\include\common.h
????I.A....??????2467??2016-11-30?10:17??jni\FaceAlignment\include\face_alignment.h
????I.A....??????3448??2016-11-30?07:03??jni\FaceAlignment\include\face_detection.h
????I.A....??????3720??2016-11-30?07:03??jni\FaceAlignment\include\sift.h
????I.A....?????13422??2016-11-30?07:03??jni\FaceAlignment\sift.cpp
????I.A....???????265??2016-11-30?07:04??jni\FaceDetection\CMakeLists.txt
????I.A....??????3361??2016-11-30?07:03??jni\FaceDetection\include\classifier\lab_boosted_classifier.h
????I.A....??????3593??2016-11-30?07:03??jni\FaceDetection\include\classifier\mlp.h
????I.A....??????2503??2016-11-30?07:03??jni\FaceDetection\include\classifier\surf_mlp.h
????I.A....??????1880??2016-11-30?07:03??jni\FaceDetection\include\classifier.h
????I.A....??????2491??2016-11-30?07:03??jni\FaceDetection\include\common.h
????I.A....??????1932??2016-11-30?07:03??jni\FaceDetection\include\detector.h
????I.A....??????3494??2016-11-30?07:03??jni\FaceDetection\include\face_detection.h
????I.A....??????3057??2016-11-30?07:03??jni\FaceDetection\include\feat\lab_feature_map.h
????I.A....??????5399??2016-11-30?07:03??jni\FaceDetection\include\feat\surf_feature_map.h
????I.A....??????1890??2016-11-30?07:03??jni\FaceDetection\include\feature_map.h
????I.A....??????3262??2016-11-30?07:03??jni\FaceDetection\include\fust.h
????I.A....??????2073??2016-11-30?07:03??jni\FaceDetection\include\io\lab_boost_model_reader.h
????I.A....??????1868??2016-11-30?07:03??jni\FaceDetection\include\io\surf_mlp_model_reader.h
............此處省略128個文件信息
- 上一篇:基于JSP的駕校考試系統(tǒng)
- 下一篇:dbcp Jar包
評論
共有 條評論