Scanbot SDK
Loading...
Searching...
No Matches
ScanbotSDK.h
Go to the documentation of this file.
1
6#pragma once
7#ifndef SCANBOTSDK_H
8#define SCANBOTSDK_H
9
10#include <stdbool.h>
11#include <stddef.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17#ifdef _WIN32
18#ifdef SBSDK_GIT_VERSION
19#define SBSDK_API __declspec(dllexport)
20#else
21#define SBSDK_API __declspec(dllimport)
22#endif
23#else
24#define SBSDK_API
25#endif
26
33
36
43
46
49
53
72
80 SCANBOTSDK_BARCODE_FORMAT_UNKNOWN = 0,
81 SCANBOTSDK_BARCODE_FORMAT_AZTEC,
82 SCANBOTSDK_BARCODE_FORMAT_CODABAR,
83 SCANBOTSDK_BARCODE_FORMAT_CODE_39,
84 SCANBOTSDK_BARCODE_FORMAT_CODE_93,
85 SCANBOTSDK_BARCODE_FORMAT_CODE_128,
86 SCANBOTSDK_BARCODE_FORMAT_DATA_MATRIX,
87 SCANBOTSDK_BARCODE_FORMAT_EAN_8,
88 SCANBOTSDK_BARCODE_FORMAT_EAN_13,
89 SCANBOTSDK_BARCODE_FORMAT_ITF,
90 SCANBOTSDK_BARCODE_FORMAT_PDF_417,
91 SCANBOTSDK_BARCODE_FORMAT_QR_CODE,
92 SCANBOTSDK_BARCODE_FORMAT_RSS_14,
93 SCANBOTSDK_BARCODE_FORMAT_RSS_EXPANDED,
94 SCANBOTSDK_BARCODE_FORMAT_UPC_A,
95 SCANBOTSDK_BARCODE_FORMAT_UPC_E,
96 SCANBOTSDK_BARCODE_FORMAT_UPC_EAN_EXTENSION,
97 SCANBOTSDK_BARCODE_FORMAT_MSI_PLESSEY,
98 SCANBOTSDK_BARCODE_FORMAT_IATA_2_OF_5,
99 SCANBOTSDK_BARCODE_FORMAT_INDUSTRIAL_2_OF_5,
100
107
144
152
156
160
170
174
178
183
185typedef struct scanbotsdk_image_t {
187 void* buffer;
188
190 int width;
191
194
197
201
214
216 const char* license_key;
218
226SBSDK_API const char* scanbotsdk_get_git_version();
227
236
244
259
266scanbotsdk_set_log_handler(void (*log_handler)(const char* message));
267
273
279SBSDK_API scanbotsdk_error_code_t scanbotsdk_log_error(const char* message);
280
296
303
313 const scanbotsdk_image_t* input,
315
323
332
342 const scanbotsdk_barcode_result_t* result,
343 int index,
345
356 const scanbotsdk_barcode_result_t* result,
357 int index,
358 const char** text);
359
379 const scanbotsdk_barcode_result_t* result,
380 int barcode_index,
381 int* quad);
382
393 const scanbotsdk_barcode_result_t* result,
394 int index,
395 const unsigned char** raw_bytes,
396 int* length);
397
400#ifdef __cplusplus
401} /* extern "C" */
402#endif
403#endif /* SCANBOTSDK_H */
scanbotsdk_error_code_t
The error codes returned by most of the Scanbot SDK functions.
Definition ScanbotSDK.h:30
@ SCANBOTSDK_ERROR_NULL_POINTER
Definition ScanbotSDK.h:45
@ SCANBOTSDK_OK
Definition ScanbotSDK.h:32
@ SCANBOTSDK_ERROR_INVALID_ARGUMENT
Definition ScanbotSDK.h:48
@ SCANBOTSDK_ERROR_INVALID_IMAGE
Definition ScanbotSDK.h:51
@ SCANBOTSDK_ERROR_INVALID_LICENSE_STATUS
Definition ScanbotSDK.h:42
@ SCANBOTSDK_ERROR
Definition ScanbotSDK.h:35
bool use_tensorrt
If true, the barcode recognizer will use the TensorRT backend for GPU acceleration.
Definition ScanbotSDK.h:169
size_t tensorrt_max_workspace_size
The maximum workspace size in bytes for TensorRT. If 0, the default value will be used.
Definition ScanbotSDK.h:181
const scanbotsdk_barcode_format_t * formats
An array of barcode formats to be detected. If null or empty, all formats will be recognized.
Definition ScanbotSDK.h:155
scanbotsdk_barcode_engine_mode_t engine_mode
The barcode recognition engine mode.
Definition ScanbotSDK.h:151
int formats_count
If formats is a valid pointer, set this field to the number of elements in the array.
Definition ScanbotSDK.h:159
int tensorrt_max_input_width
The maximum input width in pixels for TensorRT. If 0, the default value will be used.
Definition ScanbotSDK.h:173
int tensorrt_max_input_height
The maximum input height in pixels for TensorRT. If 0, the default value will be used.
Definition ScanbotSDK.h:177
SBSDK_API scanbotsdk_error_code_t scanbotsdk_barcode_result_get_text(const scanbotsdk_barcode_result_t *result, int index, const char **text)
Returns the barcode text as a null-terminated UTF8-encoded string of the given barcode in a result.
SBSDK_API scanbotsdk_error_code_t scanbotsdk_barcode_result_get_format(const scanbotsdk_barcode_result_t *result, int index, scanbotsdk_barcode_format_t *format)
Returns the barcode format of a the given barcode in a result.
scanbotsdk_barcode_engine_mode_t
Barcode recognition engine modes.
Definition ScanbotSDK.h:114
struct scanbotsdk_barcode_result_t scanbotsdk_barcode_result_t
Represents the result of a call to scanbotsdk_barcode_recognizer_recognize.
Definition ScanbotSDK.h:213
SBSDK_API scanbotsdk_error_code_t scanbotsdk_barcode_recognizer_free(scanbotsdk_barcode_recognizer_t *recognizer)
Destroys the barcode recognizer instance.
scanbotsdk_barcode_format_t
Barcode format, also called symbology.
Definition ScanbotSDK.h:79
SBSDK_API scanbotsdk_error_code_t scanbotsdk_barcode_result_get_count(const scanbotsdk_barcode_result_t *result, int *count)
Returns the count of detected barcodes in a result.
SBSDK_API scanbotsdk_error_code_t scanbotsdk_barcode_result_free(scanbotsdk_barcode_result_t *result)
Destroys the barcode result instance.
struct scanbotsdk_barcode_recognizer_t scanbotsdk_barcode_recognizer_t
Represents an instance of the barcode recognizer.
Definition ScanbotSDK.h:207
SBSDK_API scanbotsdk_error_code_t scanbotsdk_barcode_recognizer_create(const scanbotsdk_barcode_recognizer_init_params_t *params, scanbotsdk_barcode_recognizer_t **recognizer)
Creates a new instance of the barcode recognizer.
SBSDK_API scanbotsdk_error_code_t scanbotsdk_barcode_result_get_raw_bytes(const scanbotsdk_barcode_result_t *result, int index, const unsigned char **raw_bytes, int *length)
Returns the raw bytes of a given barcode from the result.
SBSDK_API scanbotsdk_error_code_t scanbotsdk_barcode_result_get_quad(const scanbotsdk_barcode_result_t *result, int barcode_index, int *quad)
Returns the coordinates in pixel space of the four corners of a given barcode in the result.
SBSDK_API scanbotsdk_error_code_t scanbotsdk_barcode_recognizer_recognize(scanbotsdk_barcode_recognizer_t *recognizer, const scanbotsdk_image_t *input, scanbotsdk_barcode_result_t **result)
Recognize barcodes in an image.
@ SCANBOTSDK_BARCODE_ENGINE_MODE_BEST
Single-shot recognition mode for static images, slower with higher accuracy.
Definition ScanbotSDK.h:142
@ SCANBOTSDK_BARCODE_ENGINE_MODE_LEGACY_FAST
Definition ScanbotSDK.h:118
@ SCANBOTSDK_BARCODE_ENGINE_MODE_FASTEST
Live recognition mode, optimized for low memory devices.
Definition ScanbotSDK.h:124
@ SCANBOTSDK_BARCODE_ENGINE_MODE_FAST
Live recognition mode with higher accuracy.
Definition ScanbotSDK.h:130
@ SCANBOTSDK_BARCODE_ENGINE_MODE_BALANCED
Single-shot recognition mode for static images.
Definition ScanbotSDK.h:136
@ SCANBOTSDK_BARCODE_FORMAT_ONE_D
Definition ScanbotSDK.h:105
Barcode recognizer initialization parameters.
Definition ScanbotSDK.h:149
scanbotsdk_license_status_t
The status of the license.
Definition ScanbotSDK.h:58
SBSDK_API const char * scanbotsdk_get_git_version()
Returns the git version of the Scanbot SDK as a null-terminated string.
SBSDK_API scanbotsdk_error_code_t scanbotsdk_get_license_status(scanbotsdk_license_status_t *status)
Returns the current license status.
SBSDK_API scanbotsdk_error_code_t scanbotsdk_initialize(const scanbotsdk_init_params_t *init_params)
Initialize the Scanbot SDK. You must always call this function before using any other Scanbot SDK fun...
@ SCANBOTSDK_LICENSE_STATUS_FAILURE_EXPIRED
Definition ScanbotSDK.h:68
@ SCANBOTSDK_LICENSE_STATUS_FAILURE_WRONG_OS
Definition ScanbotSDK.h:64
@ SCANBOTSDK_LICENSE_STATUS_FAILURE_APP_ID_MISMATCH
Definition ScanbotSDK.h:66
@ SCANBOTSDK_LICENSE_STATUS_OK
Definition ScanbotSDK.h:60
@ SCANBOTSDK_LICENSE_STATUS_FAILURE_UNKNOWN
Definition ScanbotSDK.h:70
@ SCANBOTSDK_LICENSE_STATUS_FAILURE_CORRUPTED
Definition ScanbotSDK.h:62
SBSDK_API scanbotsdk_error_code_t scanbotsdk_reset_log_handler()
Resets any previously set log handler.
SBSDK_API scanbotsdk_error_code_t scanbotsdk_log_error(const char *message)
Logs an error message using the Scanbot SDK logger.
SBSDK_API scanbotsdk_error_code_t scanbotsdk_set_logging(bool enable)
Enable or disable logging.
SBSDK_API scanbotsdk_error_code_t scanbotsdk_set_log_handler(void(*log_handler)(const char *message))
Sets the log handler.
Wrapper for image data.
Definition ScanbotSDK.h:185
int stride
Row stride in bytes, if 0 the stride will be calculated automatically.
Definition ScanbotSDK.h:199
int channels
The number of channels in the image.
Definition ScanbotSDK.h:196
int width
Image width.
Definition ScanbotSDK.h:190
void * buffer
The image buffer. The buffer data type must be an 8-bit integer.
Definition ScanbotSDK.h:187
int height
Image height.
Definition ScanbotSDK.h:193
Definition ScanbotSDK.h:215