#include "quality.h"
|
|
#include "THFaceQuality_i.h"
|
#include "csdk_struct.h"
|
|
namespace csdk_wrap{
|
int init_face_quality(const int tm, VecFunc &vec){
|
auto ret = THFQ_Create(tm);
|
if(ret != tm){
|
printf("create face quality error\n");
|
}else{
|
vec.emplace_back([]{THFQ_Release();});
|
}
|
return ret;
|
}
|
|
void set_quality_params(const int min, const int max){
|
int _min = (min<=10)?10:((min>=40)?40:min);
|
int _max = (max>=90)?90:((max<=60)?60:max);
|
const cThfqParam params{_min, _max};
|
printf("set_quality_params : %d, %d\n", _min, _max);
|
|
THFQ_SetParam((THFQ_Param*)¶ms);
|
}
|
|
cThfqResult* face_check_quality(const int chan, const cIMAGE *img, const cFacePos &pos){
|
if(chan < 0 || !img){
|
printf("face check quality error, image or pos null\n");
|
return NULL;
|
}
|
|
cThfqResult *pResult = (cThfqResult*)malloc(sizeof(cThfqResult));
|
auto ret = THFQ_Check(chan, (BYTE*)(img->data), 3, img->width, img->height, (THFI_FacePos*)(&pos), (THFQ_Result*)pResult);
|
return pResult;
|
}
|
|
int face_check_quality_brightness(const int chan, const cIMAGE *img, const cFacePos &pos, int *nBrightness){
|
if(!img){
|
printf("face check quality error, image or pos null\n");
|
return -1;
|
}
|
|
auto ret = THFQ_Check_Brightness(chan, (BYTE*)(img->data), 3, img->width, img->height, (THFI_FacePos*)(&pos), (int*)nBrightness);
|
return ret;
|
}
|
|
int face_check_quality_occlusion(const int chan, const cIMAGE *img, const cFacePos &pos, int *nOcclusion){
|
if(!img){
|
printf("face check quality error, image or pos null\n");
|
return -1;
|
}
|
|
auto ret = THFQ_Check_Occlusion(chan, (BYTE*)(img->data), 3, img->width, img->height, (THFI_FacePos*)(&pos), (int*)nOcclusion);
|
return ret;
|
}
|
int face_check_quality_hat(const int chan, const cIMAGE *img, const cFacePos &pos, int *nHat){
|
if(!img){
|
printf("face check quality error, image or pos null\n");
|
return -1;
|
}
|
|
auto ret = THFQ_Check_Hat(chan, (BYTE*)(img->data), 3, img->width, img->height, (THFI_FacePos*)(&pos), (int*)nHat);
|
return ret;
|
}
|
|
int face_check_quality_blur_glass(const int chan, const cIMAGE *img, const cFacePos &pos, int* nBlur,int* nGlasses){
|
if(!img){
|
printf("face check quality error, image or pos null\n");
|
return -1;
|
}
|
|
auto ret = THFQ_Check_BlurGlasses(chan, (BYTE*)(img->data), 3, img->width, img->height, (THFI_FacePos*)(&pos), (int*)nBlur, (int*)nGlasses);
|
return ret;
|
}
|
}
|