zhangzengfei
2024-02-05 78b0ffc543d78769580fa91842c8d635fe8c9405
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifdef __cplusplus
extern "C"{
#endif
 
#include <stdio.h>
#include "cface.h"
 
#ifdef __cplusplus
}
#endif
 
#include "csrc/face.h"
 
#include "csrc/struct.h"
 
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);
}