| | |
| | | #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 resize(void *handle, const int w, const int h, const int chan){ |
| | | |
| | | int track_resize(void *handle, const int w, const int h, const int chan){ |
| | | sdkface *s = (sdkface*)handle; |
| | | return s->resize(w, h, chan); |
| | | } |
| | | return s->track_resize(w, h, chan); |
| | | } |