移动端的qt版本人脸流程
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#ifndef THFACEIMAGE_I_H
#define THFACEIMAGE_I_H
 
#include "FiStdDefEx.h"
 
/*
* ============================================================================
*  Name     : THFaceImage_i.h
*  Part of  : Face Recognition (THFaceImage) SDK
*  Created  : 9.1.2016 by XXX
*  Description:
*     THFaceImage_i.h -  Face Recognition (THFaceImage) SDK header file
*  Version  : 4.0.0
*  Copyright: All Rights Reserved by XXXX
*  Revision:
* ============================================================================
*/
 
#define THFACEIMAGE_API extern "C"
 
//////Struct define//////
 
struct FaceAngle
{
    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 THFI_FacePos
{
    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                                
    FaceAngle    fAngle;//value of face angle
    int            nQuality;//quality of face(from 0 to 100)
    BYTE           pFacialData[512];//facial data
    THFI_FacePos()
    {
        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(FaceAngle));
        nQuality=0;
        memset(pFacialData, 0, 512);
    }
};
 
typedef long long DWORD_PTR;
struct THFI_Param
{
    int nMinFaceSize;//min face width size can be detected,default is 50 pixels
    int nRollAngle;//max face roll angle,default is 30(degree)
    bool bOnlyDetect;//ingored
    DWORD_PTR dwReserved;//reserved value,must be NULL
    THFI_Param()
    {
        nMinFaceSize=50;
        nRollAngle=30;
        bOnlyDetect=false;
        dwReserved=NULL;
    }
};
 
struct THFI_Param_Ex
{
    THFI_Param tp;
    int nDeviceID;//device id for GPU device.eg:0,1,2,3.....
    THFI_Param_Ex()
    {
        nDeviceID = 0;
    }
};
 
//////API define//////
 
THFACEIMAGE_API int        THFI_Create(short nChannelNum,THFI_Param* pParam);
/*
 The THFI_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.
*/
 
THFACEIMAGE_API int        THFI_DetectFace(short nChannelID, BYTE* pImage, int bpp, int nWidth, int nHeight, THFI_FacePos* pfps, int nMaxFaceNums, int nSampleSize=640);
/*
 The THFI_DetectFace function execute face detection only.
 
 Parameters:
    nChannelID[input],channel ID(from 0 to nChannelNum-1)
    pImage[input],image data buffer,RGB24 format.
    bpp[input],bits per pixel(24-RGB24 image),must be 24
    nWidth[input],image width.
    nHeight[input],image height.
    pfps[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:pImage,bpp,nWidth,nHeight
        -3,pfps or nMaxFaceNums is invalid.
 Remarks:
    1.image data buffer(pImage)    size must be nWidth*(bpp/8)*nHeight.
    2.pfps must be allocated by caller,the memory size is nMaxFaceNums*sizeof(THFI_FacePos).
    3.if image has face(s),face number less than or equal to nMaxFaceNums
*/
 
THFACEIMAGE_API int THFI_DetectFaceByEye(short nChannelID, BYTE* pImage, int nWidth, int nHeight, POINT ptLeft, POINT ptRight, THFI_FacePos* pfps);
/*
The THFI_DetectFaceByEye function detect facial data by eye position
 
Parameters:
    pImage[input],image data buffer,rgb24 format,pImage data size must be nWidth*nHeight*3 bytes
    nWidth[input],image width.
    nHeight[input],image height.
    ptLeft[input],left eye position
    ptRight[input],right eye position
    pfps[output],the facial position information.
Return Values:
    If the function succeeds, the return value is 1.
    If the function fails, the return value is negative.
    error code:
        -99,invalid license.
        -1,nChannelID is invalid or SDK is not initialize
        -2,image data is invalid,please check function parameter:pImage,bpp,nWidth,nHeight
        -3,pfps or nMaxFaceNums is invalid.
*/
 
THFACEIMAGE_API void    THFI_Release();
/*
 The THFI_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.
*/
 
THFACEIMAGE_API int        THFI_Create_Ex(short nChannelNum, THFI_Param_Ex* pParam);
/*
The THFI_Create_Ex function will initialize the algorithm engine module,,only for GPU version
 
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.
*/
 
#endif