CommonLibraries/include/yolo_runtime.h

93 lines
3.5 KiB
C
Raw Normal View History

#pragma once
#include "yolo_runtime_types.h"
#if defined(_WIN32)
#define YOLO_RUNTIME_API
#elif defined(__GNUC__) || defined(__clang__)
#define YOLO_RUNTIME_API __attribute__((visibility("default")))
#else
#define YOLO_RUNTIME_API
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct yolo_runtime yolo_runtime_t;
typedef struct yolo_result_set yolo_result_set_t;
/* Compose mask_count binary (0/255) masks into an RGB888 canvas, without dilation.
IDs are input index + 1 (1..255); origins locate masks on the canvas.
Background=(0,0,0), single=(id,id,id), two=(id1,id2,id1),
three=(id1,id2,id3), where id1 < id2 < id3. Remove zero/duplicate
channels to decode membership. Holes and disconnected regions are preserved.
Zero masks (masks may be NULL) produces a black canvas.
Caller owns output; capacity must cover (height-1)*stride + width*3 bytes.
Padding and the entire output on failure remain unchanged. Output must not
overlap mask data. More than 255 masks or >3 memberships at any pixel returns
UNSUPPORTED; malformed binary data/bounds return INVALID_ARGUMENT.
This additive API does not change the existing ABI 5 structures/interfaces. */
YOLO_RUNTIME_API yolo_status_t yolo_masks_compose_rgb_ids(
const yolo_mask_view_v1_t* masks, uint32_t mask_count,
int32_t width, int32_t height, unsigned char* output,
int32_t row_stride_bytes, uint64_t output_capacity_bytes,
yolo_error_info_v1_t* error);
YOLO_RUNTIME_API uint32_t yolo_runtime_get_abi_version(void);
YOLO_RUNTIME_API yolo_status_t yolo_runtime_create(
const char* config_path,
yolo_runtime_t** runtime,
yolo_error_info_v1_t* error);
YOLO_RUNTIME_API yolo_status_t yolo_runtime_get_info(
const yolo_runtime_t* runtime,
yolo_runtime_info_v1_t* info);
YOLO_RUNTIME_API yolo_status_t yolo_runtime_infer_image(
yolo_runtime_t* runtime,
const yolo_image_view_v1_t* image,
const yolo_infer_options_v1_t* options,
yolo_result_set_t** results,
yolo_error_info_v1_t* error);
YOLO_RUNTIME_API yolo_status_t yolo_result_set_get_count(
const yolo_result_set_t* results,
uint32_t* count);
YOLO_RUNTIME_API yolo_status_t yolo_result_set_get_performance(
const yolo_result_set_t* results,
yolo_performance_v1_t* performance);
YOLO_RUNTIME_API yolo_status_t yolo_result_set_get_common(
const yolo_result_set_t* results,
uint32_t index,
yolo_result_common_v1_t* result);
YOLO_RUNTIME_API yolo_status_t yolo_result_set_get_bbox(
const yolo_result_set_t* results,
uint32_t index,
yolo_bbox_v1_t* bbox);
YOLO_RUNTIME_API yolo_status_t yolo_result_set_get_obb(
const yolo_result_set_t* results,
uint32_t index,
yolo_rotated_rect_v1_t* obb);
YOLO_RUNTIME_API yolo_status_t yolo_result_set_get_seg_mask(
const yolo_result_set_t* results,
uint32_t index,
yolo_mask_view_v1_t* mask);
YOLO_RUNTIME_API yolo_status_t yolo_result_set_get_seg_geometry(
const yolo_result_set_t* results,
uint32_t index,
yolo_seg_geometry_v1_t* geometry);
YOLO_RUNTIME_API yolo_status_t yolo_result_set_get_pose_keypoint_count(
const yolo_result_set_t* results,
uint32_t index,
uint32_t* count);
YOLO_RUNTIME_API yolo_status_t yolo_result_set_copy_pose_keypoints(
const yolo_result_set_t* results,
uint32_t index,
yolo_keypoint_v1_t* keypoints,
uint32_t capacity,
uint32_t* count);
YOLO_RUNTIME_API void yolo_result_set_release(yolo_result_set_t* results);
YOLO_RUNTIME_API void yolo_runtime_destroy(yolo_runtime_t* runtime);
#ifdef __cplusplus
}
#endif