DJI Thermal SDK API v1.4 Infrared camera image processing and temperature measurement library API

dirp_api.h
Go to the documentation of this file.
1 /*
2 * DJI Thermal SDK API definition.
3 *
4 * @Copyright (c) 2020-2023 DJI. All rights reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 *
24 */
25
26 #pragma once
27
28 #ifndef _DIRP_API_H_
29 #define _DIRP_API_H_
30
31 #include "stdint.h"
32
33 #ifdef _WIN32
34 #define dllexport __declspec(dllexport)
35 #else
36 #define dllexport __attribute__ ((visibility("default")))
37 #endif
38
39 #define DIRP_PSEUDO_COLOR_LUT_DEPTH (256)
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
49 typedef enum
50 {
51 DIRP_SUCCESS = 0,
52 DIRP_ERROR_MALLOC = -1,
53 DIRP_ERROR_POINTER_NULL = -2,
54 DIRP_ERROR_INVALID_PARAMS = -3,
55 DIRP_ERROR_INVALID_RAW = -4,
56 DIRP_ERROR_INVALID_HEADER = -5,
57 DIRP_ERROR_INVALID_CURVE = -6,
58 DIRP_ERROR_RJPEG_PARSE = -7,
59 DIRP_ERROR_SIZE = -8,
60 DIRP_ERROR_INVALID_HANDLE = -9,
61 DIRP_ERROR_FORMAT_INPUT = -10,
62 DIRP_ERROR_FORMAT_OUTPUT = -11,
63 DIRP_ERROR_UNSUPPORTED_FUNC = -12,
64 DIRP_ERROR_NOT_READY = -13,
65 DIRP_ERROR_ACTIVATION = -14,
66 DIRP_ERROR_INVALID_INI = -15,
67 DIRP_ERROR_INVALID_SUB_DLL = -16,
68 DIRP_ERROR_ADVANCED = -32,
69 } dirp_ret_code_e;
70
76 typedef enum
77 {
78 DIRP_PSEUDO_COLOR_WHITEHOT = 0,
79 DIRP_PSEUDO_COLOR_FULGURITE,
80 DIRP_PSEUDO_COLOR_IRONRED,
81 DIRP_PSEUDO_COLOR_HOTIRON,
82 DIRP_PSEUDO_COLOR_MEDICAL,
83 DIRP_PSEUDO_COLOR_ARCTIC,
84 DIRP_PSEUDO_COLOR_RAINBOW1,
85 DIRP_PSEUDO_COLOR_RAINBOW2,
86 DIRP_PSEUDO_COLOR_TINT,
87 DIRP_PSEUDO_COLOR_BLACKHOT,
88 DIRP_PSEUDO_COLOR_NUM,
89 } dirp_pseudo_color_e;
90
91 typedef enum
92 {
93 DIRP_VERBOSE_LEVEL_NONE = 0,
94 DIRP_VERBOSE_LEVEL_DEBUG,
95 DIRP_VERBOSE_LEVEL_DETAIL,
96 DIRP_VERBOSE_LEVEL_NUM,
97 } dirp_verbose_level_e;
98
99 #pragma pack(push, 1)
100
104 typedef struct
105 {
106 uint32_t api;
107 char magic[8];
108 } dirp_api_version_t;
109
113 typedef struct
114 {
115 uint32_t rjpeg;
116 uint32_t header;
117 uint32_t curve;
118 } dirp_rjpeg_version_t;
119
124 typedef struct {
125 int32_t width;
126 int32_t height;
127 } dirp_resolution_t;
128
132 typedef struct {
133 bool enable;
134 float high;
135 float low;
136 } dirp_isotherm_t;
137
141 typedef struct{
142 bool manual_enable;
143 float high;
144 float low;
145 } dirp_color_bar_t;
146
150 typedef struct{
151 uint8_t red [DIRP_PSEUDO_COLOR_NUM][DIRP_PSEUDO_COLOR_LUT_DEPTH];
152 uint8_t green[DIRP_PSEUDO_COLOR_NUM][DIRP_PSEUDO_COLOR_LUT_DEPTH];
153 uint8_t blue [DIRP_PSEUDO_COLOR_NUM][DIRP_PSEUDO_COLOR_LUT_DEPTH];
154 } dirp_isp_pseudo_color_lut_t;
155
159 typedef struct
160 {
161 int32_t brightness;
162 } dirp_enhancement_params_t;
163
167 typedef struct {
168 float distance;
170 float humidity;
172 float emissivity;
174 float reflection;
178 } dirp_measurement_params_t;
179
183 typedef struct {
184 struct {float min; float max;} distance;
185 struct {float min; float max;} humidity;
186 struct {float min; float max;} emissivity;
187 struct {float min; float max;} reflection;
188 } dirp_measurement_params_range_t;
189
196 typedef void *DIRP_HANDLE;
197
198 #pragma pack(pop)
199
212 dllexport int32_t dirp_create_from_rjpeg(const uint8_t *data, int32_t size, DIRP_HANDLE *ph);
213
220 dllexport int32_t dirp_destroy(DIRP_HANDLE h);
221
228 dllexport int32_t dirp_get_api_version(dirp_api_version_t *version);
229
237 dllexport int32_t dirp_get_rjpeg_version(DIRP_HANDLE h, dirp_rjpeg_version_t *version);
238
246 dllexport int32_t dirp_get_rjpeg_resolution(DIRP_HANDLE h, dirp_resolution_t *resolution);
247
256 dllexport int32_t dirp_get_original_raw(DIRP_HANDLE h, uint16_t *raw_image, int32_t size);
257
271 dllexport int32_t dirp_process(DIRP_HANDLE h, uint8_t *color_image, int32_t size);
272
285 dllexport int32_t dirp_process_strech(DIRP_HANDLE h, float *strech_image, int32_t size);
286
299 dllexport int32_t dirp_measure(DIRP_HANDLE h, int16_t *temp_image, int32_t size);
300
312 dllexport int32_t dirp_measure_ex(DIRP_HANDLE h, float *temp_image, int32_t size);
313
321 dllexport int32_t dirp_set_isotherm(DIRP_HANDLE h, const dirp_isotherm_t *isotherm);
322
330 dllexport int32_t dirp_get_isotherm(DIRP_HANDLE h, dirp_isotherm_t *isotherm);
331
339 dllexport int32_t dirp_set_color_bar(DIRP_HANDLE h, const dirp_color_bar_t *color_bar);
340
348 dllexport int32_t dirp_get_color_bar(DIRP_HANDLE h, dirp_color_bar_t *color_bar);
349
364 dllexport int32_t dirp_get_color_bar_adaptive_params(DIRP_HANDLE h, dirp_color_bar_t *color_bar);
365
373 dllexport int32_t dirp_set_pseudo_color(DIRP_HANDLE h, dirp_pseudo_color_e pseudo_color);
374
382 dllexport int32_t dirp_get_pseudo_color(DIRP_HANDLE h, dirp_pseudo_color_e *pseudo_color);
383
391 dllexport int32_t dirp_get_pseudo_color_lut(DIRP_HANDLE h, dirp_isp_pseudo_color_lut_t *pseudo_lut);
392
400 dllexport int32_t dirp_set_enhancement_params(DIRP_HANDLE h, const dirp_enhancement_params_t *enhancement_params);
401
409 dllexport int32_t dirp_get_enhancement_params(DIRP_HANDLE h, dirp_enhancement_params_t *enhancement_params);
410
418 dllexport int32_t dirp_set_measurement_params(DIRP_HANDLE h, const dirp_measurement_params_t *measurement_params);
419
427 dllexport int32_t dirp_get_measurement_params(DIRP_HANDLE h, dirp_measurement_params_t *measurement_params);
428
436 dllexport int32_t dirp_get_measurement_params_range(DIRP_HANDLE h, dirp_measurement_params_range_t *params_range);
437
443 dllexport void dirp_set_verbose_level(dirp_verbose_level_e level);
444
450 dllexport void dirp_set_logger_file(const char *file_name);
451
452 #ifdef __cplusplus
453 }
454 #endif
455
456 #endif /* _DIRP_API_H_ */
DIRP_ERROR_FORMAT_INPUT
Definition: dirp_api.h:61
dirp_get_pseudo_color_lut
dllexport int32_t dirp_get_pseudo_color_lut(DIRP_HANDLE h, dirp_isp_pseudo_color_lut_t *pseudo_lut)
Get ISP pseudo color LUT.
DIRP_PSEUDO_COLOR_ARCTIC
Definition: dirp_api.h:83
DIRP_PSEUDO_COLOR_RAINBOW1
Definition: dirp_api.h:84
dirp_rjpeg_version_t::curve
uint32_t curve
Definition: dirp_api.h:117
dirp_pseudo_color_e
dirp_pseudo_color_e
Palette types.
Definition: dirp_api.h:76
DIRP_ERROR_SIZE
Definition: dirp_api.h:59
DIRP_VERBOSE_LEVEL_DEBUG
Definition: dirp_api.h:94
DIRP_ERROR_MALLOC
Definition: dirp_api.h:52
DIRP_VERBOSE_LEVEL_DETAIL
Definition: dirp_api.h:95
DIRP_PSEUDO_COLOR_MEDICAL
Definition: dirp_api.h:82
dirp_verbose_level_e
dirp_verbose_level_e
Definition: dirp_api.h:91
DIRP_ERROR_INVALID_RAW
Definition: dirp_api.h:55
DIRP_VERBOSE_LEVEL_NUM
Definition: dirp_api.h:96
dirp_set_logger_file
dllexport void dirp_set_logger_file(const char *file_name)
Set external logger file.
dirp_set_measurement_params
dllexport int32_t dirp_set_measurement_params(DIRP_HANDLE h, const dirp_measurement_params_t *measurement_params)
Set custom temperature measurement parameters.
DIRP_ERROR_NOT_READY
Definition: dirp_api.h:64
dirp_measurement_params_range_t
Range of temperature measurement parameteres structure definition.
Definition: dirp_api.h:183
dirp_set_isotherm
dllexport int32_t dirp_set_isotherm(DIRP_HANDLE h, const dirp_isotherm_t *isotherm)
Set custom ISP isotherm parameters.
DIRP_ERROR_UNSUPPORTED_FUNC
Definition: dirp_api.h:63
dirp_isotherm_t
Isotherm parameters structure definition.
Definition: dirp_api.h:132
dirp_rjpeg_version_t::rjpeg
uint32_t rjpeg
Definition: dirp_api.h:115
dirp_rjpeg_version_t::header
uint32_t header
Definition: dirp_api.h:116
dirp_color_bar_t::manual_enable
bool manual_enable
Definition: dirp_api.h:142
DIRP_PSEUDO_COLOR_BLACKHOT
Definition: dirp_api.h:87
DIRP_ERROR_INVALID_CURVE
Definition: dirp_api.h:57
dirp_isotherm_t::enable
bool enable
Definition: dirp_api.h:133
DIRP_ERROR_INVALID_INI
Definition: dirp_api.h:66
dirp_destroy
dllexport int32_t dirp_destroy(DIRP_HANDLE h)
Destroy the DIRP handle.
dirp_isp_pseudo_color_lut_t
Pseudo color LUT array structure definition.
Definition: dirp_api.h:150
dirp_get_measurement_params_range
dllexport int32_t dirp_get_measurement_params_range(DIRP_HANDLE h, dirp_measurement_params_range_t *params_range)
Get range of temperature measurement parameters that user can set.
DIRP_PSEUDO_COLOR_FULGURITE
Definition: dirp_api.h:79
DIRP_PSEUDO_COLOR_HOTIRON
Definition: dirp_api.h:81
dirp_enhancement_params_t
Image enhancement parameteres structure definition.
Definition: dirp_api.h:159
DIRP_PSEUDO_COLOR_RAINBOW2
Definition: dirp_api.h:85
DIRP_VERBOSE_LEVEL_NONE
Definition: dirp_api.h:93
dirp_api_version_t::api
uint32_t api
Definition: dirp_api.h:106
dirp_process_strech
dllexport int32_t dirp_process_strech(DIRP_HANDLE h, float *strech_image, int32_t size)
Run ISP strech algorithm with RAW data in R-JPEG and output FLOAT32 streching image.
dirp_get_color_bar
dllexport int32_t dirp_get_color_bar(DIRP_HANDLE h, dirp_color_bar_t *color_bar)
Get orignial/custom ISP color bar parameters.
dirp_rjpeg_version_t
R-JPEG version structure definition.
Definition: dirp_api.h:113
dirp_process
dllexport int32_t dirp_process(DIRP_HANDLE h, uint8_t *color_image, int32_t size)
Run ISP algorithm with RAW data in R-JPEG and output RGB pseudo color image.
dirp_get_color_bar_adaptive_params
dllexport int32_t dirp_get_color_bar_adaptive_params(DIRP_HANDLE h, dirp_color_bar_t *color_bar)
Get adaptive ISP color bar parameters in automatic mode.
dirp_isotherm_t::high
float high
Definition: dirp_api.h:134
dirp_measurement_params_t::reflection
float reflection
Definition: dirp_api.h:174
dirp_measure
dllexport int32_t dirp_measure(DIRP_HANDLE h, int16_t *temp_image, int32_t size)
Measure temperature of whole thermal image with RAW data in R-JPEG.
dirp_create_from_rjpeg
dllexport int32_t dirp_create_from_rjpeg(const uint8_t *data, int32_t size, DIRP_HANDLE *ph)
Create a new DIRP handle with specified R-JPEG binary data.
DIRP_ERROR_ADVANCED
Definition: dirp_api.h:68
DIRP_PSEUDO_COLOR_LUT_DEPTH
#define DIRP_PSEUDO_COLOR_LUT_DEPTH
Definition: dirp_api.h:39
dirp_color_bar_t::low
float low
Definition: dirp_api.h:144
dirp_measurement_params_range_t::min
float min
Definition: dirp_api.h:184
DIRP_ERROR_INVALID_HEADER
Definition: dirp_api.h:56
dirp_get_rjpeg_resolution
dllexport int32_t dirp_get_rjpeg_resolution(DIRP_HANDLE h, dirp_resolution_t *resolution)
Get R-JPEG image resolution information.
DIRP_ERROR_FORMAT_OUTPUT
Definition: dirp_api.h:62
DIRP_ERROR_INVALID_PARAMS
Definition: dirp_api.h:54
DIRP_HANDLE
void * DIRP_HANDLE
Structure representing a handle on a DIRP instance.
Definition: dirp_api.h:196
dllexport
#define dllexport
Definition: dirp_api.h:36
dirp_get_isotherm
dllexport int32_t dirp_get_isotherm(DIRP_HANDLE h, dirp_isotherm_t *isotherm)
Get orignial/custom ISP isotherm parameters.
dirp_ret_code_e
dirp_ret_code_e
Error codes.
Definition: dirp_api.h:49
dirp_get_api_version
dllexport int32_t dirp_get_api_version(dirp_api_version_t *version)
Get API version.
dirp_get_enhancement_params
dllexport int32_t dirp_get_enhancement_params(DIRP_HANDLE h, dirp_enhancement_params_t *enhancement_params)
Get orignial/custom ISP enhancement parameters.
dirp_get_original_raw
dllexport int32_t dirp_get_original_raw(DIRP_HANDLE h, uint16_t *raw_image, int32_t size)
Get original RAW binary data from R-JPEG.
dirp_enhancement_params_t::brightness
int32_t brightness
Definition: dirp_api.h:161
DIRP_PSEUDO_COLOR_NUM
Definition: dirp_api.h:88
DIRP_SUCCESS
Definition: dirp_api.h:51
DIRP_PSEUDO_COLOR_WHITEHOT
Definition: dirp_api.h:78
dirp_get_measurement_params
dllexport int32_t dirp_get_measurement_params(DIRP_HANDLE h, dirp_measurement_params_t *measurement_params)
Get orignial/custom temperature measurement parameters.
DIRP_PSEUDO_COLOR_IRONRED
Definition: dirp_api.h:80
dirp_set_pseudo_color
dllexport int32_t dirp_set_pseudo_color(DIRP_HANDLE h, dirp_pseudo_color_e pseudo_color)
Set custom ISP pseudo color type.
dirp_isotherm_t::low
float low
Definition: dirp_api.h:135
dirp_color_bar_t
Color bar parameters structure definition.
Definition: dirp_api.h:141
dirp_measurement_params_t::distance
float distance
Definition: dirp_api.h:168
dirp_resolution_t::width
int32_t width
Definition: dirp_api.h:125
dirp_set_verbose_level
dllexport void dirp_set_verbose_level(dirp_verbose_level_e level)
Set log print level.
dirp_set_color_bar
dllexport int32_t dirp_set_color_bar(DIRP_HANDLE h, const dirp_color_bar_t *color_bar)
Set custom ISP color bar parameters.
DIRP_ERROR_INVALID_HANDLE
Definition: dirp_api.h:60
dirp_resolution_t
The image size structure definition.
Definition: dirp_api.h:124
dirp_set_enhancement_params
dllexport int32_t dirp_set_enhancement_params(DIRP_HANDLE h, const dirp_enhancement_params_t *enhancement_params)
Set custom ISP enhancement parameters.
DIRP_ERROR_INVALID_SUB_DLL
Definition: dirp_api.h:67
DIRP_ERROR_RJPEG_PARSE
Definition: dirp_api.h:58
dirp_get_rjpeg_version
dllexport int32_t dirp_get_rjpeg_version(DIRP_HANDLE h, dirp_rjpeg_version_t *version)
Get R-JPEG version.
dirp_measurement_params_t
Customize temperature measurement parameteres structure definition.
Definition: dirp_api.h:167
DIRP_ERROR_ACTIVATION
Definition: dirp_api.h:65
DIRP_PSEUDO_COLOR_TINT
Definition: dirp_api.h:86
dirp_measure_ex
dllexport int32_t dirp_measure_ex(DIRP_HANDLE h, float *temp_image, int32_t size)
Measure temperature of whole thermal image with RAW data in R-JPEG.
dirp_api_version_t
API version structure definition.
Definition: dirp_api.h:104
dirp_measurement_params_t::humidity
float humidity
Definition: dirp_api.h:170
dirp_get_pseudo_color
dllexport int32_t dirp_get_pseudo_color(DIRP_HANDLE h, dirp_pseudo_color_e *pseudo_color)
Get orignial/custom ISP pseudo color type.
dirp_color_bar_t::high
float high
Definition: dirp_api.h:143
DIRP_ERROR_POINTER_NULL
Definition: dirp_api.h:53
dirp_measurement_params_t::emissivity
float emissivity
Definition: dirp_api.h:172
dirp_resolution_t::height
int32_t height
Definition: dirp_api.h:126