LightlyEdge C++ SDK
Loading...
Searching...
No Matches
lightly_edge_rs_bindings.h
1/* © 2024 Lightly AI. All rights reserved. */
2
3#ifndef LIGHTLY_EDGE_RS_BINDINGS_H
4#define LIGHTLY_EDGE_RS_BINDINGS_H
5
6/* Generated with cbindgen:0.27.0 */
7
8/* WARNING: This file is autogenerated by cbindgen. Don't modify this manually. */
9
10#include <cstdarg>
11#include <cstddef>
12#include <cstdint>
13#include <cstdlib>
14#include <ostream>
15#include <new>
16
17namespace lightly_edge_rs {
18
19constexpr static const uint16_t SUCCESS_CODE = 0;
20
21constexpr static const int32_t NO_SUBCLASS = -1;
22
24struct LightlyEdge;
25
26struct CStatus {
27 uint16_t code;
28 const char *error_message;
29};
30
32 uint32_t class_id;
33 int32_t subclass_id;
34 int32_t x;
35 int32_t y;
36 int32_t w;
37 int32_t h;
38 float confidence;
39};
40
43 bool should_select;
44 float min_distance;
45};
46
49 bool should_select;
50 float distance;
51};
52
55 bool should_select;
56 float min_distance;
57};
58
60 uint32_t class_id;
61 int32_t subclass_id;
62 float threshold;
63 bool should_select;
64};
65
66struct SelectionStrategiesSelectInfo {
67 DiversitySelectInfo *out_diversity_buffer;
68 size_t diversity_buffer_size;
69 size_t *out_diversity_size;
70 SimilaritySelectInfo *out_similarity_buffer;
71 size_t similarity_buffer_size;
72 size_t *out_similarity_size;
73 AdaptiveDiversitySelectInfo *out_adaptive_diversity_buffer;
74 size_t adaptive_diversity_buffer_size;
75 size_t *out_adaptive_diversity_size;
76 DetectionSelectInfo *out_detection_buffer;
77 size_t detection_buffer_size;
78 size_t *out_detection_size;
79};
80
83 float x0;
84 float y0;
85 float w;
86 float h;
87};
88
89extern "C" {
90
92void destroy(LightlyEdge * lightly_edge);
93
95CStatus embed_frame(const LightlyEdge * lightly_edge,
96 uint8_t *rgb_image_data,
97 size_t rgb_image_data_size,
98 uint32_t width,
99 uint32_t height,
100 float *out_embedding_buffer);
101
103CStatus insert_into_embedding_database(LightlyEdge * lightly_edge,
104 const float *embedding_buffer,
105 size_t embedding_buffer_size);
106
108CStatus register_diversity_strategy(LightlyEdge * lightly_edge, float min_distance);
109
111size_t num_diversity_strategies(const LightlyEdge * lightly_edge);
112
114size_t num_patches(const LightlyEdge * lightly_edge);
115
117CStatus register_similarity_strategy(LightlyEdge * lightly_edge,
118 const float *query_embedding_buffer,
119 size_t query_embedding_buffer_size,
120 float max_distance);
121
123size_t num_similarity_strategies(const LightlyEdge * lightly_edge);
124
126CStatus register_detection_strategy(LightlyEdge * lightly_edge,
127 uint32_t class_id,
128 int32_t subclass_id,
129 float threshold);
130
132size_t num_detection_strategies(const LightlyEdge * lightly_edge);
133
135CStatus register_adaptive_diversity_strategy(LightlyEdge * lightly_edge,
136 float target_ratio,
137 size_t max_buffer_length);
138
140size_t num_adaptive_diversity_strategies(const LightlyEdge * lightly_edge);
141
143void clear_strategies(LightlyEdge * lightly_edge);
144
146CStatus should_select(LightlyEdge * lightly_edge,
147 const float *embedding_buffer,
148 size_t embedding_buffer_size,
149 const ObjectDetection *detection_buffer,
150 size_t detection_buffer_size,
151 SelectionStrategiesSelectInfo *out_info);
152
154CStatus should_select_with_patches(LightlyEdge * lightly_edge,
155 const float *const *embeddings_buffer,
156 size_t num_embeddings,
157 size_t embedding_dim,
158 const ObjectDetection *detection_buffer,
159 size_t detection_buffer_size,
160 SelectionStrategiesSelectInfo *out_info);
161
163size_t embedding_dimension(const LightlyEdge * lightly_edge);
164
166CStatus detect(const LightlyEdge * lightly_edge,
167 uint8_t *rgb_image_data,
168 size_t rgb_image_data_size,
169 uint32_t width,
170 uint32_t height,
171 ObjectDetection *out_detections_buffer,
172 size_t *out_detections_len);
173
175CStatus detection_class_labels(const LightlyEdge * lightly_edge,
176 const char **out_classes_buffer,
177 size_t *out_classes_len);
178
180CStatus detection_subclass_labels(const LightlyEdge * lightly_edge,
181 uint32_t class_id,
182 const char **out_subclasses_buffer,
183 size_t *out_subclasses_len);
184
186CStatus set_embedding_patches(LightlyEdge * lightly_edge,
187 const PatchCoordsRel *patches,
188 size_t num_patches);
189
191void reset_embedding_patches(LightlyEdge * lightly_edge);
192
194CStatus embed_patches(const LightlyEdge * lightly_edge,
195 uint8_t *rgb_image_data,
196 size_t rgb_image_data_size,
197 uint32_t width,
198 uint32_t height,
199 float **out_embedding_buffer);
200
202CStatus create_status_impl(uint16_t code, const char *error_message);
203
205void free_status_message(CStatus * status);
206
207} // extern "C"
208
209} // namespace lightly_edge_rs
210
211#endif // LIGHTLY_EDGE_RS_BINDINGS_H
212
213
Holds information whether a frame should be selected or not.
Definition lightly_edge_rs_bindings.h:54
Definition lightly_edge_rs_bindings.h:59
Holds information whether a frame should be selected or not.
Definition lightly_edge_rs_bindings.h:42
Definition lightly_edge_rs_bindings.h:31
A patch specified by relative coordinates.
Definition lightly_edge_rs_bindings.h:82
Holds information whether a frame should be selected or not.
Definition lightly_edge_rs_bindings.h:48