From a3dc3aa4ec63bcc7844bc4ae7a77f992b9fa74dd Mon Sep 17 00:00:00 2001
From: chenshijun <chenshijun@aiotlink.com>
Date: 星期三, 09 九月 2020 09:57:52 +0800
Subject: [PATCH] 添加人脸质量的.h和.so文件

---
 csrc/buz/face/quality.cpp |   75 +++++++++++++++++++++++++++++++++++++
 1 files changed, 75 insertions(+), 0 deletions(-)

diff --git a/csrc/buz/face/quality.cpp b/csrc/buz/face/quality.cpp
new file mode 100644
index 0000000..417fc60
--- /dev/null
+++ b/csrc/buz/face/quality.cpp
@@ -0,0 +1,75 @@
+#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*)&params);
+    }
+
+    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;
+    }
+}
\ No newline at end of file

--
Gitblit v1.8.0