#ifndef EDGEFIRST_DETECT_H
#define EDGEFIRST_DETECT_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ef_detect_box {
float xmin;
float ymin;
float xmax;
float ymax;
float score;
uint32_t label;
} ef_detect_box;
typedef struct ef_segmentation {
float xmin;
float ymin;
float xmax;
float ymax;
const uint8_t *mask;
uint32_t width;
uint32_t height;
} ef_segmentation;
typedef struct ef_merge_config {
uint32_t metric;
float threshold;
int class_agnostic;
uintptr_t max_det;
float score_threshold;
uint32_t mode;
} ef_merge_config;
typedef struct ef_tile_placement {
uintptr_t index;
uintptr_t count;
float origin_x;
float origin_y;
float crop_width;
float crop_height;
int has_content_region;
float content_region[4];
float frame_width;
float frame_height;
} ef_tile_placement;
enum ef_fit
#if defined(__cplusplus) || __STDC_VERSION__ >= 202311L
: uint32_t
#endif
{
EF_FIT_STRETCH = 0,
EF_FIT_LETTERBOX = 1,
};
#ifndef __cplusplus
#if __STDC_VERSION__ >= 202311L
typedef enum ef_fit ef_fit;
#else
typedef uint32_t ef_fit;
#endif
#endif
enum ef_letterbox_placement
#if defined(__cplusplus) || __STDC_VERSION__ >= 202311L
: uint32_t
#endif
{
EF_LETTERBOX_PLACEMENT_CENTER = 0,
EF_LETTERBOX_PLACEMENT_TOP_LEFT = 1,
};
#ifndef __cplusplus
#if __STDC_VERSION__ >= 202311L
typedef enum ef_letterbox_placement ef_letterbox_placement;
#else
typedef uint32_t ef_letterbox_placement;
#endif
#endif
enum ef_pad_space
#if defined(__cplusplus) || __STDC_VERSION__ >= 202311L
: uint32_t
#endif
{
EF_PAD_SPACE_PIXEL = 0,
EF_PAD_SPACE_NORMALIZED = 1,
};
#ifndef __cplusplus
#if __STDC_VERSION__ >= 202311L
typedef enum ef_pad_space ef_pad_space;
#else
typedef uint32_t ef_pad_space;
#endif
#endif
enum ef_interpolation
#if defined(__cplusplus) || __STDC_VERSION__ >= 202311L
: uint32_t
#endif
{
EF_INTERPOLATION_BILINEAR = 0,
EF_INTERPOLATION_NEAREST = 1,
EF_INTERPOLATION_BICUBIC = 2,
EF_INTERPOLATION_AREA = 3,
};
#ifndef __cplusplus
#if __STDC_VERSION__ >= 202311L
typedef enum ef_interpolation ef_interpolation;
#else
typedef uint32_t ef_interpolation;
#endif
#endif
typedef struct ef_preprocess_spec {
uint32_t width;
uint32_t height;
uint32_t fit;
uint32_t placement;
uint32_t pad_space;
float pad[3];
float mean[3];
float std[3];
uint32_t interpolation;
} ef_preprocess_spec;
static inline ef_preprocess_spec ef_preprocess_spec_default(void) {
ef_preprocess_spec s;
int i;
s.width = 0;
s.height = 0;
s.fit = EF_FIT_LETTERBOX;
s.placement = EF_LETTERBOX_PLACEMENT_CENTER;
s.pad_space = EF_PAD_SPACE_PIXEL;
for (i = 0; i < 3; i++) {
s.pad[i] = 114.0f;
s.mean[i] = 0.0f;
s.std[i] = 255.0f;
}
s.interpolation = EF_INTERPOLATION_BILINEAR;
return s;
}
#ifdef __cplusplus
}
#endif
#endif