From d3b3f6b835cb7fcbb3712f876e84c8ed625170a2 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期三, 15 一月 2020 11:30:08 +0800 Subject: [PATCH] Merge branch 'cuda-8.0' of ssh://192.168.5.5:29418/libgowrapper/face into cuda-8.0 --- cface.cpp | 86 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 86 insertions(+), 0 deletions(-) diff --git a/cface.cpp b/cface.cpp new file mode 100644 index 0000000..99ab41c --- /dev/null +++ b/cface.cpp @@ -0,0 +1,86 @@ +#ifdef __cplusplus +extern "C"{ +#endif + +#include <stdio.h> +#include "cface.h" + +#ifdef __cplusplus +} +#endif + +#include "csrc/face.h" + +#include "csrc/struct.h" + +#include "csrc/face.cpp" + +using namespace cppface; + +void *create_sdkface(){ + return new sdkface(); +} + +void release(void *handle){ + if (handle){ + sdkface *s = (sdkface*)handle; + delete s; + } +} + +int init_detector(void *handle, const int min_faces, const int roll_angles, + const int threads_max, const int gpu){ + sdkface *s = (sdkface*)handle; + return s->detector(min_faces, roll_angles, threads_max, gpu); +} + +int init_extractor(void *handle, const int threads_max, const int gpu){ + sdkface *s = (sdkface*)handle; + return s->extractor(threads_max, gpu); +} + +int init_propertizer(void *handle, const int threads_max){ + sdkface *s = (sdkface*)handle; + return s->propertizer(threads_max); +} + +int init_tracker(void *handle, const int width, const int height, + const int max_faces, const int interval, const int sample_size, + const int threads_max, const int gpu){ + sdkface *s = (sdkface*)handle; + return s->tracker(width, height, max_faces, interval, sample_size, threads_max, gpu); +} + +int detect(void *handle, const void *data, const int w, const int h, const int c, const int chan, void **fpos, int *fcnt){ + sdkface *s = (sdkface*)handle; + cIMAGE img{(unsigned char*)data, w, h, c}; + return s->detect(&img, chan, fpos, fcnt); +} + +int extract(void *handle, const cFacePos *pos, const void*data, const int w, const int h, const int c, const int chan, void **feat, int *featLen){ + sdkface *s = (sdkface*)handle; + cIMAGE img{(unsigned char*)data, w, h, c}; + return s->extract(*pos, &img, chan, feat, featLen); +} + +float compare(void *handle, unsigned char *feat1, unsigned char *feat2){ + sdkface *s = (sdkface*)handle; + return s->compare(feat1, feat2); +} + +int propertize(void *handle, const cFacePos *pos, const void *data, const int w, const int h, const int c, const int chan, void **res){ + sdkface *s = (sdkface*)handle; + cIMAGE img{(unsigned char*)data, w, h, c}; + return s->propertize(*pos, &img, chan, res); +} + +int track(void *handle, const void *data, const int w, const int h, const int c, const int chan, void **fInfo, int *fcnt){ + sdkface *s = (sdkface*)handle; + cIMAGE img{(unsigned char*)data, w, h, c}; + return s->track(&img, chan, fInfo, fcnt); +} + +int track_resize(void *handle, const int w, const int h, const int chan){ + sdkface *s = (sdkface*)handle; + return s->track_resize(w, h, chan); +} -- Gitblit v1.8.0