DJI Thermal SDK API  v1.5
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 {
70 
76 typedef enum
77 {
90 
91 typedef enum
92 {
98 
99 #pragma pack(push, 1)
100 
104 typedef struct
105 {
106  uint32_t api;
107  char magic[8];
109 
113 typedef struct
114 {
115  uint32_t rjpeg;
116  uint32_t header;
117  uint32_t curve;
119 
124 typedef struct {
125  int32_t width;
126  int32_t height;
128 
132 typedef struct {
133  bool enable;
134  float high;
135  float low;
137 
141 typedef struct{
143  float high;
144  float low;
146 
150 typedef struct{
155 
159 typedef struct
160 {
161  int32_t brightness;
163 
167 typedef struct {
168  float distance;
170  float humidity;
172  float emissivity;
174  float reflection;
178  float ambient_temp;
181 
185 typedef struct {
186  struct {float min; float max;} distance;
187  struct {float min; float max;} humidity;
188  struct {float min; float max;} emissivity;
189  struct {float min; float max;} reflection;
190  struct {float min; float max;} ambient_temp;
192 
199 typedef void *DIRP_HANDLE;
200 
201 #pragma pack(pop)
202 
215 dllexport int32_t dirp_create_from_rjpeg(const uint8_t *data, int32_t size, DIRP_HANDLE *ph);
216 
224 
233 
242 
251 
260 dllexport int32_t dirp_get_original_raw(DIRP_HANDLE h, uint16_t *raw_image, int32_t size);
261 
275 dllexport int32_t dirp_process(DIRP_HANDLE h, uint8_t *color_image, int32_t size);
276 
289 dllexport int32_t dirp_process_strech(DIRP_HANDLE h, float *strech_image, int32_t size);
290 
303 dllexport int32_t dirp_measure(DIRP_HANDLE h, int16_t *temp_image, int32_t size);
304 
316 dllexport int32_t dirp_measure_ex(DIRP_HANDLE h, float *temp_image, int32_t size);
317 
325 dllexport int32_t dirp_set_isotherm(DIRP_HANDLE h, const dirp_isotherm_t *isotherm);
326 
335 
343 dllexport int32_t dirp_set_color_bar(DIRP_HANDLE h, const dirp_color_bar_t *color_bar);
344 
353 
369 
378 
387 
396 
404 dllexport int32_t dirp_set_enhancement_params(DIRP_HANDLE h, const dirp_enhancement_params_t *enhancement_params);
405 
414 
422 dllexport int32_t dirp_set_measurement_params(DIRP_HANDLE h, const dirp_measurement_params_t *measurement_params);
423 
432 
441 
448 
454 dllexport void dirp_set_logger_file(const char *file_name);
455 
456 #ifdef __cplusplus
457 }
458 #endif
459 
460 #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:185
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:186
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:199
dirp_get_api_version
dllexport int32_t dirp_get_api_version(DIRP_HANDLE h, dirp_api_version_t *version)
Get API version.
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_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_measurement_params_t::ambient_temp
float ambient_temp
Definition: dirp_api.h:178
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