派生自 libgowrapper/yolo

zhangmeng
2019-12-10 eb19ddaebdf451cee76dc31082a3194a5f9b50ac
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
#ifdef __cplusplus
extern "C"{
#endif
 
#include "cyolo.h"
 
#ifdef __cplusplus
}
#endif
 
#include "csrc/yolo.h"
 
#include "csrc/struct.h"
 
#include "csrc/yolo.cpp"
 
using namespace cppyolo;
 
void* init(const char *cfg, const char *weights, const char *name, const int gpu){
    return new sdkyolo(cfg, weights, name, gpu);
}
 
void release(void *handle){
    if (handle){
        sdkyolo *h = (sdkyolo*)handle;
        delete h;
    }
}
 
int detect(void *handle, 
            const void *data, const int w, const int h, const int c,
            const float thrsh, const int use_mean, 
            void **objInfos, int *objCount){
 
    sdkyolo *y = (sdkyolo*)handle;
    cIMAGE img{(unsigned char*)data, w, h, c};
    return y->detect(&img, thrsh, use_mean, objInfos, objCount);
}
 
const char* obj_name_by_type(void *handle, const int typ){
    sdkyolo *h = (sdkyolo*)handle;
    return h->obj_name_by_type(typ);
}