#ifndef THFACETRACKING_I_H
|
#define THFACETRACKING_I_H
|
|
#include "FiStdDefEx.h"
|
|
/*
|
* ============================================================================
|
* Name : THFaceTracking_i.h
|
* Part of : Face Tracking (THFaceTracking) SDK
|
* Created : 11.22.2017 by XXX
|
* Description:
|
* THFaceTracking_i.h - Face Tracking (THFaceTracking) SDK header file
|
* Version : 1.0.0
|
* Copyright: All Rights Reserved by XXXX
|
* Revision:
|
* ============================================================================
|
*/
|
|
struct FacePose
|
{
|
int yaw;//angle of yaw,from -90 to +90,left is negative,right is postive
|
int pitch;//angle of pitch,from -90 to +90,up is negative,down is postive
|
int roll;//angle of roll,from -90 to +90,left is negative,right is postive
|
float confidence;//confidence of face pose(from 0 to 1,0.6 is suggested threshold)
|
};
|
|
struct THFT_FaceInfo
|
{
|
RECT rcFace;//coordinate of face
|
POINT ptLeftEye;//coordinate of left eye
|
POINT ptRightEye;//coordinate of right eye
|
POINT ptMouth;//coordinate of mouth
|
POINT ptNose;//coordinate of nose
|
FacePose fAngle;//value of face angle
|
int nQuality;//quality of face(from 0 to 100)
|
BYTE pFacialData[8*1024];//facial data
|
|
long nFaceID;//face tracking id
|
|
THFT_FaceInfo()
|
{
|
memset(&rcFace, 0, sizeof(RECT));
|
memset(&ptLeftEye, 0, sizeof(POINT));
|
memset(&ptRightEye, 0, sizeof(POINT));
|
memset(&ptMouth, 0, sizeof(POINT));
|
memset(&ptNose, 0, sizeof(POINT));
|
memset(&fAngle, 0, sizeof(FacePose));
|
nQuality = 0;
|
memset(pFacialData, 0, 8 * 1024);
|
|
nFaceID = -1;
|
}
|
};
|
|
struct THFT_Param
|
{
|
int nDeviceID;//device id for GPU device.eg:0,1,2,3.....
|
|
int nImageWidth;//image width of video
|
int nImageHeight;//image height of video
|
int nMaxFaceNum;//max face number for tracking
|
int nSampleSize;//down sample size for face detection
|
int nDetectionIntervalFrame;//interval frame number of face detection for face tracking
|
|
THFT_Param()
|
{
|
nMaxFaceNum = 100;
|
nSampleSize = 640;
|
nDeviceID = 0;
|
nDetectionIntervalFrame = 5;
|
}
|
};
|
|
#define THFACETRACKING_API extern "C"
|
|
|
THFACETRACKING_API int THFT_Create(short nChannelNum,THFT_Param* pParam);
|
/*
|
The THFT_Create function will initialize the algorithm engine module
|
|
Parameters:
|
nChannelNum[intput],algorithm channel num,for multi-thread mode,one thread uses one channel
|
pParam[input],algorithm engine parameter.
|
Return Values:
|
If the function succeeds, the return value is valid channel number.
|
If the function fails, the return value is zero or negative;
|
error code:
|
-99,invalid license.
|
Remarks:
|
This function only can be called one time at program initialization.
|
*/
|
|
THFACETRACKING_API void THFT_Release();
|
/*
|
The THFT_Release function will release the algorithm engine module
|
|
Parameters:
|
No parameter.
|
Return Values:
|
No return value.
|
Remarks:
|
This function only can be called one time at program exit.
|
*/
|
|
THFACETRACKING_API int THFT_FaceTracking(short nChannelID, unsigned char* pBGR,THFT_FaceInfo* pFaceInfos);
|
/*
|
The THFT_FaceTracking function execute face detection and face tracking
|
|
Parameters:
|
nChannelID[input],channel ID(from 0 to nChannelNum-1)
|
pBGR[input],image data buffer,BGR format.
|
pFaceInfos[output],the facial position information.
|
Return Values:
|
If the function succeeds, the return value is face number.
|
If the function fails, the return value is negative.
|
error code:
|
-99,invalid license.
|
-1,nChannelID is invalid or SDK is not initialized
|
-2,image data is invalid,please check function parameter:pBGR
|
-3,pFaceInfos is invalid.
|
Remarks:
|
1.image data buffer(pBGR) size must be (THFT_Param::nImageWidth * THFT_Param::nImageHeight * 3)
|
2.pFaceInfos must be allocated by caller,the memory size is THFT_Param::nMaxFaceNum*sizeof(THFT_FaceInfo).
|
3.if image has face(s),face number less than or equal to THFT_Param::nMaxFaceNums
|
*/
|
|
THFACETRACKING_API int THFT_FaceDetect(short nChannelID, BYTE* pBGR, int nWidth, int nHeight, THFT_FaceInfo* pFaceInfos, int nMaxFaceNums, int nSampleSize);
|
/*
|
The THFT_FaceDetect function execute facial detection for an image
|
|
Parameters:
|
nChannelID[input],channel ID(from 0 to nChannelNum-1)
|
pBGR[input],image data buffer,BGR format.
|
nWidth[input],image width.
|
nHeight[input],image height.
|
pFaceInfos[output],the facial position information.
|
nMaxFaceNums[input],max face nums that you want
|
nSampleSize[input],down sample size(image down sample) for detect image,if it is 0,will detect by original image.
|
Return Values:
|
If the function succeeds, the return value is face number.
|
If the function fails, the return value is negative.
|
error code:
|
-99,invalid license.
|
-1,nChannelID is invalid or SDK is not initialized
|
-2,image data is invalid,please check function parameter:pBGR,nWidth,nHeight
|
-3,pFaceInfos or nMaxFaceNums is invalid.
|
Remarks:
|
1.image data buffer(pBGR) size must be nWidth*nHeight*3.
|
2.pFaceInfos must be allocated by caller,the memory size is nMaxFaceNums*sizeof(THFT_FaceInfo).
|
3.if image has face(s),face number less than or equal to nMaxFaceNums
|
*/
|
|
THFACETRACKING_API int THFT_FaceOnly(short nChannelID, BYTE* pBGR, int nWidth, int nHeight, RECT* pFaces, int nMaxFaceNums, int nSampleSize);
|
/*
|
The THFT_FaceOnly function execute face rectangle detection only
|
|
Parameters:
|
nChannelID[input],channel ID(from 0 to nChannelNum-1)
|
pBGR[input],image data buffer,BGR format.
|
nWidth[input],image width.
|
nHeight[input],image height.
|
pFaces[output],the face rectangle
|
nMaxFaceNums[input],max face nums that you want
|
nSampleSize[input],down sample size(image down sample) for detect image,if it is 0,will detect by original image.
|
Return Values:
|
If the function succeeds, the return value is face number.
|
If the function fails, the return value is negative.
|
error code:
|
-99,invalid license.
|
-1,nChannelID is invalid or SDK is not initialized
|
-2,image data is invalid,please check function parameter:pBGR,nWidth,nHeight
|
-3,pFaces or nMaxFaceNums is invalid.
|
Remarks:
|
1.image data buffer(pBGR) size must be nWidth*nHeight*3.
|
2.pFaces must be allocated by caller,the memory size is nMaxFaceNums*sizeof(RECT).
|
3.if image has face(s),face number less than or equal to nMaxFaceNums
|
*/
|
|
|
#endif
|