LUXAND人脸识别(linux版本)

https://www.luxand.com/

https://www.zhihu.com/question/19561362


#include
#include "LuxandFaceSDK.h"


using namespace cv;


int main(int argc,char**argv)
{
int ReValue =-1;
int handle=-1;
char id[25];
char licenseInfo[512];
HImage Image;
TFacePosition FacePosition;
FSDK_Features Features;
char AttributeValues[1024];
ReValue = FSDK_ActivateLibrary("Mo4qSgmy0E0e+1Pm3+A82UAP52wUMs93F5Hes5ebgY0Rl5Qj2aMSTqKjlOjZDfghkqqXiuqtPCDeJzjU57YMlNOpAZbqMCGvKryTi82NWS2xZJCkaokCnZT1Wcmtjio2YTUo4Wylr8KkkUTR+md3iP4Cs68YZDmMmkc1ILYg0Pc=");

if(ReValue!=FSDKE_OK)
{
printf("FSDK_ActivateLibrary Failed\n");
return -1;
}else
printf("FSDK_ActivateLibrary success\n");

ReValue = FSDK_Initialize(NULL);

if(ReValue!=FSDKE_OK)
{
printf("FSDK_Initialize Failed\n");
return -1;
}else
printf("FSDK_Initialize success\n");



ReValue = FSDK_GetHardware_ID(id);


printf("id-ReValue:%d\nid:%s\n",ReValue,id);

ReValue = FSDK_GetLicenseInfo(licenseInfo);

printf("licenseinfo-ReValue:%d\nlicenseInfo:%s\n",ReValue,licenseInfo);


ReValue = FSDK_LoadImageFromFile(&Image,argv[1]);

printf("loadimae-ReValue:%d\n",ReValue);


ReValue = FSDK_DetectFace(Image,&FacePosition);


printf("face position-ReValue(%d):x:%d y:%d angle:%f\n",ReValue,FacePosition.xc,FacePosition.yc,FacePosition.angle);

ReValue =FSDK_SaveImageToFile(Image,"./test.jpg");


printf("saveimage-ReValue:%d\n",ReValue);

ReValue = FSDK_DetectFacialFeatures(Image,&Features);


printf("facialFeatures-ReValue:%d\n",ReValue);


printf("left[%d]\n",Features[FSDKP_LEFT_EYE].x);
printf("right[%d]\n",Features[FSDKP_RIGHT_EYE].x);


ReValue = FSDK_DetectFacialAttributeUsingFeatures(Image,&Features,"Gender;Expression",AttributeValues,sizeof(AttributeValues));

printf("attributeValuesFeatures-ReValue:%d\n",ReValue);


float ConfidenceMale = 0.0f; 
float ConfidenceFemale = 0.0f; 
float ConfidenceFeSmile =0.0f;


FSDK_GetValueConfidence(AttributeValues, "Male", &ConfidenceMale); 
FSDK_GetValueConfidence(AttributeValues, "Female", &ConfidenceFemale);
FSDK_GetValueConfidence(AttributeValues, "Smile", &ConfidenceFeSmile);


printf("male:%.2f%% fmale:%.2f%% smile:%.2f%%\n",(ConfidenceMale*100),ConfidenceFemale*100,ConfidenceFeSmile*100);


//ReValue = FSDK_Finalize();

//printf("---end ReValue:%d\n",ReValue);

return 0;
}



你可能感兴趣的:(LUXAND人脸识别(linux版本))