fully separate C-API from CPP-API

This commit is contained in:
Stefano Sinigardi
2019-02-19 15:57:18 +01:00
parent 6e7c7976d7
commit 00de023601
8 changed files with 66 additions and 27 deletions

View File

@ -1,23 +1,37 @@
#ifndef YOLO_V2_CLASS_HPP
#define YOLO_V2_CLASS_HPP
#include "darknet.h"
#ifndef LIB_API
#ifdef LIB_EXPORTS
#if defined(_MSC_VER)
#define LIB_API __declspec(dllexport)
#else
#define LIB_API __attribute__((visibility("default")))
#endif
#else
#if defined(_MSC_VER)
#define LIB_API
#else
#define LIB_API
#endif
#endif
#endif
#define C_SHARP_MAX_OBJECTS 1000
struct bbox_t {
unsigned int x, y, w, h; // (x,y) - top-left corner, (w, h) - width & height of bounded box
unsigned int x, y, w, h; // (x,y) - top-left corner, (w, h) - width & height of bounded box
float prob; // confidence - probability that the object was found correctly
unsigned int obj_id; // class of object - from range [0, classes-1]
unsigned int track_id; // tracking id for video (0 - untracked, 1 - inf - tracked object)
unsigned int frames_counter;// counter of frames on which the object was detected
unsigned int obj_id; // class of object - from range [0, classes-1]
unsigned int track_id; // tracking id for video (0 - untracked, 1 - inf - tracked object)
unsigned int frames_counter; // counter of frames on which the object was detected
};
struct image_t {
int h; // height
int w; // width
int c; // number of chanels (3 - for RGB)
float *data; // pointer to the image data
float *data; // pointer to the image data
};
struct bbox_t_container {
@ -34,7 +48,7 @@ struct bbox_t_container {
#include <opencv2/opencv.hpp> // C++
#include <opencv2/highgui/highgui_c.h> // C
#include <opencv2/imgproc/imgproc_c.h> // C
#endif // OPENCV
#endif
extern "C" LIB_API int init(const char *configurationFilename, const char *weightsFilename, int gpu);
extern "C" LIB_API int detect_image(const char *filename, bbox_t_container &container);