SmartFace Embedded Toolkit  4.2.1
Loading...
Searching...
No Matches
sfe_core.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <stdbool.h>
11#include <stddef.h>
12#include <stdint.h>
13
14#include "sfe_core_detection.h"
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
21typedef enum SFEHwidMethod {
35
37typedef enum SFELicenseType {
49
51typedef enum SFEImageFormat {
65
70typedef struct SFEImage {
72 size_t width;
74 size_t height;
76 unsigned char *data;
78
82
84typedef struct SFEImageInfo {
86 size_t width;
88 size_t height;
92
97typedef void *SFEError;
98
102typedef void *SFESolver;
103
105typedef struct SFESolverParameter {
107 const char *name;
109 const char *value;
111
114typedef struct SFEEntity {
115 uint8_t uuid[16];
117
121 float score;
123 size_t index;
125
129 float score;
131 size_t index;
135
139const char *const sfeVersion();
140
144
150const char *sfeErrorMessage(SFEError error);
151
163SFEError sfeHwidGet(char *out_hwid, size_t *in_out_hwid_len,
164 SFEHwidMethod method);
165
174
182
189void sfeLicenseSet(const unsigned char *data, const size_t data_len);
190
197SFEError sfeSolverCreate(const char *solver_file,
198 const SFESolverParameter *solver_parameters,
199 size_t solver_parameters_count, SFESolver *out_solver);
200
204
214SFEError sfeImageDecode(const unsigned char *data, size_t data_len,
215 SFEImage *out_image);
216
226 unsigned char *out_data, size_t *in_out_data_len);
227
233SFEError sfeImageInfo(const unsigned char *data, size_t data_len,
234 SFEImageInfo *out_image_info);
235
239
245
252SFEError sfeImageResize(SFEImageView image, size_t width, size_t height,
253 SFEImage *out_image);
254
263 size_t height, SFEImage *out_image);
264
265// CORE DETECTION
266
277 SFEDetection *out_detections,
278 size_t *in_out_detection_count);
279
280// CORE TRACKING
281
286typedef void *SFETracker;
287
294};
295
297typedef struct SFETracked {
301 uint64_t id;
307
317sfeDetectionTrackerCreate(float new_track_threshold, float track_high_threshold,
318 float track_low_threshold, float match_threshold,
319 uint64_t max_time_lost, SFETracker *out_tracker);
320
324
337 const SFEDetection *detections,
338 size_t detections_count,
339 SFETracked *out_tracked,
340 size_t *in_out_tracked_count);
341
349 size_t *in_out_entities_count);
350
358 size_t *in_out_entities_count);
359
360#ifdef __cplusplus
361} // extern "C"
362#endif
std::optional< std::string > solver
SFEError sfeImageColorTranspose(SFEImageView image, SFEImage *out_image)
Transpose RGB<->BGR color channel order.
void sfeSolverFree(SFESolver solver)
Free memory associated with SFESolver.
SFEError sfeDetectionTrackerCreate(float new_track_threshold, float track_high_threshold, float track_low_threshold, float match_threshold, uint64_t max_time_lost, SFETracker *out_tracker)
Create a new tracker.
SFEError sfeImageResize(SFEImageView image, size_t width, size_t height, SFEImage *out_image)
Resize image.
SFEHwidMethod
Supported methods for Hardware ID (HWID) computation.
Definition sfe_core.h:21
@ SFE_HWID_METHOD_PHY
Definition sfe_core.h:30
@ SFE_HWID_METHOD_MAC
Definition sfe_core.h:24
@ SFE_HWID_METHOD_SYS
Definition sfe_core.h:32
@ SFE_HWID_METHOD_ANDROID_ID
Definition sfe_core.h:33
@ SFE_HWID_METHOD_IMEI
Definition sfe_core.h:26
@ SFE_HWID_METHOD_DISK_ID
Definition sfe_core.h:23
@ SFE_HWID_METHOD_SERIAL_NUMBER
Definition sfe_core.h:25
@ SFE_HWID_METHOD_MAC_ADDRESS
Definition sfe_core.h:31
@ SFE_HWID_METHOD_SM_BIOS
Definition sfe_core.h:27
@ SFE_HWID_METHOD_AUTO
Definition sfe_core.h:22
@ SFE_HWID_METHOD_APP_ID
Definition sfe_core.h:29
@ SFE_HWID_METHOD_AMAZON
Definition sfe_core.h:28
SFEError sfeLicenseValidate(void)
Validate a license for this product. This process conducts checks to confirm the license's validity f...
SFEError sfeDetectionTrackerUpdate(SFETracker tracker, const SFEDetection *detections, size_t detections_count, SFETracked *out_tracked, size_t *in_out_tracked_count)
Update the tracker.
SFELicenseType
License types.
Definition sfe_core.h:37
@ SFE_LICENSE_TYPE_FILE
License was read from a file.
Definition sfe_core.h:41
@ SFE_LICENSE_TYPE_ENV
License was read from an environment variable.
Definition sfe_core.h:47
@ SFE_LICENSE_TYPE_TOKEN
License was read from a USB token.
Definition sfe_core.h:45
@ SFE_LICENSE_TYPE_NONE
License was not read.
Definition sfe_core.h:39
@ SFE_LICENSE_TYPE_MEMORY
License was read from memory.
Definition sfe_core.h:43
SFEError sfeHwidGet(char *out_hwid, size_t *in_out_hwid_len, SFEHwidMethod method)
Get Hardware ID (HWID) of the current machine.
void sfeErrorFree(SFEError error)
Free memory associated with SFEError.
SFEError sfeDetectionTrackerRemoved(SFETracker tracker, SFEEntity *out_entities, size_t *in_out_entities_count)
Get removed entities after update.
void * SFESolver
Solver provides an abstract interface over inference models and engines.
Definition sfe_core.h:102
void sfeLicenseSet(const unsigned char *data, const size_t data_len)
Set the license data via environment variable. The environment variable that will be set: ILICENSE_DA...
SFEImage SFEImageView
Raw raster image view, HWC|BGR order.
Definition sfe_core.h:81
void * SFEError
Error type used to hold optional error message.
Definition sfe_core.h:97
void sfeImageFree(SFEImage image)
Free memory associated with SFEImage.
SFEError sfeLicenseType(SFELicenseType *out_license_type)
Get license type. This function returns the type of license that is currently active without performi...
SFEImageFormat
Supported image formats.
Definition sfe_core.h:51
@ SFE_IMAGE_FORMAT_BMP
Windows Bitmap format.
Definition sfe_core.h:61
@ SFE_IMAGE_FORMAT_PNG
Portable Network Graphics format.
Definition sfe_core.h:53
@ SFE_IMAGE_FORMAT_GIF
Graphics Interchange Format.
Definition sfe_core.h:57
@ SFE_IMAGE_FORMAT_QOI
Quite OK Image format.
Definition sfe_core.h:63
@ SFE_IMAGE_FORMAT_TGA
Truevision TGA format.
Definition sfe_core.h:59
@ SFE_IMAGE_FORMAT_JPEG
Joint Photographic Experts Group format.
Definition sfe_core.h:55
SFEError sfeImageEncode(SFEImageView image, SFEImageFormat image_format, unsigned char *out_data, size_t *in_out_data_len)
Encode SFEImage into a buffer with specified image_format.
SFEError sfeSolverCreate(const char *solver_file, const SFESolverParameter *solver_parameters, size_t solver_parameters_count, SFESolver *out_solver)
Create new solver from solver file.
const char *const sfeVersion()
Get version of the toolkit library.
void sfeDetectionTrackerFree(SFETracker tracker)
Free the tracker.
SFETrackedState
Tracked state.
Definition sfe_core.h:289
@ SFE_TRACKED_STATE_REMOVED
Definition sfe_core.h:293
@ SFE_TRACKED_STATE_LOST
Definition sfe_core.h:292
@ SFE_TRACKED_STATE_TRACKED
Definition sfe_core.h:291
@ SFE_TRACKED_STATE_NEW
Definition sfe_core.h:290
SFEError sfeImageResizeWithAspectRatio(SFEImageView image, size_t width, size_t height, SFEImage *out_image)
Resize image with maintaining aspect ratio. Whole resized image will be fitted and centered inside ou...
SFEError sfeDetectionTrackerLost(SFETracker tracker, SFEEntity *out_entities, size_t *in_out_entities_count)
Get lost entities after update.
SFEError sfeImageInfo(const unsigned char *data, size_t data_len, SFEImageInfo *out_image_info)
Try to get information from image data without fully decoding it.
SFEError sfeImageDecode(const unsigned char *data, size_t data_len, SFEImage *out_image)
Decode SFEImage from raw image data of various formats. Eg. PNG, JPEG ..
const char * sfeErrorMessage(SFEError error)
Get error message.
SFEError sfeDetect(SFESolver solver, SFEImageView image, float threshold, SFEDetection *out_detections, size_t *in_out_detection_count)
Detect objects in the source image using unified detection API.
void * SFETracker
Tracker is a ByteTrack implementation for multi-modal tracking across multiple frames.
Definition sfe_core.h:286
File containing core detection type definitions.
Core detection - tagged union containing all detection types.
Entity type, used to group templates for entity identification. This type is compatible with uuid_v4 ...
Definition sfe_core.h:114
uint8_t uuid[16]
Definition sfe_core.h:115
Candidate for identification by entity.
Definition sfe_core.h:127
float score
matching score
Definition sfe_core.h:129
SFEEntity entity
candidate entity id
Definition sfe_core.h:133
size_t index
index of the entity from the input gallery
Definition sfe_core.h:131
Raw owned raster image representation, HWC|BGR order.
Definition sfe_core.h:70
size_t width
Width of the image in pixels.
Definition sfe_core.h:72
unsigned char * data
Pointer to raw HWC|BGR data, size is width * height * 3.
Definition sfe_core.h:76
size_t height
Height of the image in pixels.
Definition sfe_core.h:74
Image information structure, for describing image format and size.
Definition sfe_core.h:84
size_t height
Height of the image in pixels.
Definition sfe_core.h:88
SFEImageFormat format
Format of the image.
Definition sfe_core.h:90
size_t width
Width of the image in pixels.
Definition sfe_core.h:86
Solver parameter used to configure solvers.
Definition sfe_core.h:105
const char * value
parameter value
Definition sfe_core.h:109
const char * name
parameter name
Definition sfe_core.h:107
Candidate for identification by template.
Definition sfe_core.h:119
size_t index
index of the template from the input gallery
Definition sfe_core.h:123
Tracked entity struct.
Definition sfe_core.h:297
uint64_t id
Tracked ID.
Definition sfe_core.h:301
SFEDetection detection
Tracked detection.
Definition sfe_core.h:299
SFEEntity uuid
UUID.
Definition sfe_core.h:303
enum SFETrackedState state
Tracking state.
Definition sfe_core.h:305