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

Data Structures | Macros | Typedefs | Enumerations | Functions
dirp_api.h File Reference
`#include "stdint.h"`

Go to the source code of this file.

## Data Structures
struct | dirp_api_version_t
| API version structure definition. More...
struct | dirp_rjpeg_version_t
| R-JPEG version structure definition. More...
struct | dirp_resolution_t
| The image size structure definition. More...
struct | dirp_isotherm_t
| Isotherm parameters structure definition. More...
struct | dirp_color_bar_t
| Color bar parameters structure definition. More...
struct | dirp_isp_pseudo_color_lut_t
| Pseudo color LUT array structure definition. More...
struct | dirp_enhancement_params_t
| Image enhancement parameteres structure definition. More...
struct | dirp_measurement_params_t
| Customize temperature measurement parameteres structure definition. More...
struct | dirp_measurement_params_range_t
| Range of temperature measurement parameteres structure definition. More...

## Macros
#define | _DIRP_API_H_
#define | dllexport __attribute__ ((visibility("default")))
#define | DIRP_PSEUDO_COLOR_LUT_DEPTH (256)

## Typedefs
typedef void * | DIRP_HANDLE
| Structure representing a handle on a DIRP instance. More...

## Enumerations
enum | dirp_ret_code_e { DIRP_SUCCESS = 0, DIRP_ERROR_MALLOC = -1, DIRP_ERROR_POINTER_NULL = -2, DIRP_ERROR_INVALID_PARAMS = -3, DIRP_ERROR_INVALID_RAW = -4, DIRP_ERROR_INVALID_HEADER = -5, DIRP_ERROR_INVALID_CURVE = -6, DIRP_ERROR_RJPEG_PARSE = -7, DIRP_ERROR_SIZE = -8, DIRP_ERROR_INVALID_HANDLE = -9, DIRP_ERROR_FORMAT_INPUT = -10, DIRP_ERROR_FORMAT_OUTPUT = -11, DIRP_ERROR_UNSUPPORTED_FUNC = -12, DIRP_ERROR_NOT_READY = -13, DIRP_ERROR_ACTIVATION = -14, DIRP_ERROR_INVALID_INI = -15, DIRP_ERROR_INVALID_SUB_DLL = -16, DIRP_ERROR_ADVANCED = -32 }
| Error codes. More...
enum | dirp_pseudo_color_e { DIRP_PSEUDO_COLOR_WHITEHOT = 0, DIRP_PSEUDO_COLOR_FULGURITE, DIRP_PSEUDO_COLOR_IRONRED, DIRP_PSEUDO_COLOR_HOTIRON, DIRP_PSEUDO_COLOR_MEDICAL, DIRP_PSEUDO_COLOR_ARCTIC, DIRP_PSEUDO_COLOR_RAINBOW1, DIRP_PSEUDO_COLOR_RAINBOW2, DIRP_PSEUDO_COLOR_TINT, DIRP_PSEUDO_COLOR_BLACKHOT, DIRP_PSEUDO_COLOR_NUM }
| Palette types. More...
enum | dirp_verbose_level_e { DIRP_VERBOSE_LEVEL_NONE = 0, DIRP_VERBOSE_LEVEL_DEBUG, DIRP_VERBOSE_LEVEL_DETAIL, DIRP_VERBOSE_LEVEL_NUM }

## Functions
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. More...
dllexport int32_t | dirp_destroy (DIRP_HANDLE h)
| Destroy the DIRP handle. More...
dllexport int32_t | dirp_get_api_version (dirp_api_version_t *version)
| Get API version. More...
dllexport int32_t | dirp_get_rjpeg_version (DIRP_HANDLE h, dirp_rjpeg_version_t *version)
| Get R-JPEG version. More...
dllexport int32_t | dirp_get_rjpeg_resolution (DIRP_HANDLE h, dirp_resolution_t *resolution)
| Get R-JPEG image resolution information. More...
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. More...
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. More...
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. More...
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. More...
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. More...
dllexport int32_t | dirp_set_isotherm (DIRP_HANDLE h, const dirp_isotherm_t *isotherm)
| Set custom ISP isotherm parameters. More...
dllexport int32_t | dirp_get_isotherm (DIRP_HANDLE h, dirp_isotherm_t *isotherm)
| Get orignial/custom ISP isotherm parameters. More...
dllexport int32_t | dirp_set_color_bar (DIRP_HANDLE h, const dirp_color_bar_t *color_bar)
| Set custom ISP color bar parameters. More...
dllexport int32_t | dirp_get_color_bar (DIRP_HANDLE h, dirp_color_bar_t *color_bar)
| Get orignial/custom ISP color bar parameters. More...
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. More...
dllexport int32_t | dirp_set_pseudo_color (DIRP_HANDLE h, dirp_pseudo_color_e pseudo_color)
| Set custom ISP pseudo color type. More...
dllexport int32_t | dirp_get_pseudo_color (DIRP_HANDLE h, dirp_pseudo_color_e *pseudo_color)
| Get orignial/custom ISP pseudo color type. More...
dllexport int32_t | dirp_get_pseudo_color_lut (DIRP_HANDLE h, dirp_isp_pseudo_color_lut_t *pseudo_lut)
| Get ISP pseudo color LUT. More...
dllexport int32_t | dirp_set_enhancement_params (DIRP_HANDLE h, const dirp_enhancement_params_t *enhancement_params)
| Set custom ISP enhancement parameters. More...
dllexport int32_t | dirp_get_enhancement_params (DIRP_HANDLE h, dirp_enhancement_params_t *enhancement_params)
| Get orignial/custom ISP enhancement parameters. More...
dllexport int32_t | dirp_set_measurement_params (DIRP_HANDLE h, const dirp_measurement_params_t *measurement_params)
| Set custom temperature measurement parameters. More...
dllexport int32_t | dirp_get_measurement_params (DIRP_HANDLE h, dirp_measurement_params_t *measurement_params)
| Get orignial/custom temperature measurement parameters. More...
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. More...
dllexport void | dirp_set_verbose_level (dirp_verbose_level_e level)
| Set log print level. More...
dllexport void | dirp_set_logger_file (const char *file_name)
| Set external logger file. More...

## Macro Definition Documentation

## ◆ _DIRP_API_H_

#define _DIRP_API_H_

## ◆ DIRP_PSEUDO_COLOR_LUT_DEPTH

#define DIRP_PSEUDO_COLOR_LUT_DEPTH (256)

## ◆ dllexport

#define dllexport __attribute__ ((visibility("default")))

## Typedef Documentation

## ◆ DIRP_HANDLE

typedef void* DIRP_HANDLE

Structure representing a handle on a DIRP instance.

It is usually originating from dirp_create_from_rjpeg function. A DIRP handle is used to perform image processing and temperature measurement operations. When finished a DIRP processing, you should call dirp_destroy function.

## Enumeration Type Documentation

## ◆ dirp_pseudo_color_e

enum dirp_pseudo_color_e

Palette types.

There are variety of palette options. Distinct colors are used to show temperature differences in the thermal image, which are related to grayscale intensity.

Enumerator
DIRP_PSEUDO_COLOR_WHITEHOT | 0: White Hot
DIRP_PSEUDO_COLOR_FULGURITE | 1: Fulgurite
DIRP_PSEUDO_COLOR_IRONRED | 2: Iron Red
DIRP_PSEUDO_COLOR_HOTIRON | 3: Hot Iron
DIRP_PSEUDO_COLOR_MEDICAL | 4: Medical
DIRP_PSEUDO_COLOR_ARCTIC | 5: Arctic
DIRP_PSEUDO_COLOR_RAINBOW1 | 6: Rainbow 1
DIRP_PSEUDO_COLOR_RAINBOW2 | 7: Rainbow 2
DIRP_PSEUDO_COLOR_TINT | 8: Tint
DIRP_PSEUDO_COLOR_BLACKHOT | 9: Black Hot
DIRP_PSEUDO_COLOR_NUM | 10: Total number

## ◆ dirp_ret_code_e

enum dirp_ret_code_e

Error codes.

Most DIRP functions return 0 on success or one of negative value on failure.

Enumerator
DIRP_SUCCESS | 0: Success (no error)
DIRP_ERROR_MALLOC | -1: Malloc error
DIRP_ERROR_POINTER_NULL | -2: NULL pointer input
DIRP_ERROR_INVALID_PARAMS | -3: Invalid parameters input
DIRP_ERROR_INVALID_RAW | -4: Invalid RAW in R-JPEG
DIRP_ERROR_INVALID_HEADER | -5: Invalid header in R-JPEG
DIRP_ERROR_INVALID_CURVE | -6: Invalid curve LUT in R-JPEG
DIRP_ERROR_RJPEG_PARSE | -7: Parse error for R-JPEG data
DIRP_ERROR_SIZE | -8: Wrong size input
DIRP_ERROR_INVALID_HANDLE | -9: Invalid handle input
DIRP_ERROR_FORMAT_INPUT | -10: Wrong input image format
DIRP_ERROR_FORMAT_OUTPUT | -11: Wrong output image format
DIRP_ERROR_UNSUPPORTED_FUNC | -12: Unsupported function called
DIRP_ERROR_NOT_READY | -13: Some preliminary conditions not meet
DIRP_ERROR_ACTIVATION | -14: SDK activate failed
DIRP_ERROR_INVALID_INI | -15: Invalid ini file
DIRP_ERROR_INVALID_SUB_DLL | -16: Invalid sub DLL
DIRP_ERROR_ADVANCED | -32: Advanced error codes which may be smaller than this value

## ◆ dirp_verbose_level_e

enum dirp_verbose_level_e

Enumerator
DIRP_VERBOSE_LEVEL_NONE | 0: Print none
DIRP_VERBOSE_LEVEL_DEBUG | 1: Print debug log
DIRP_VERBOSE_LEVEL_DETAIL | 2: Print all log
DIRP_VERBOSE_LEVEL_NUM | 3: Total number

## Function Documentation

## ◆ 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.

The R-JPEG binary data buffer must remain valid until the handle is destroyed. The DIRP API library will create some alloc buffers for inner usage. So the application should reserve enough stack size for the library.

Parameters

  [in] | data | R-JPEG binary data buffer pointer
  [in] | size | R-JPEG binary data buffer size in bytes
  [out] | ph | DIRP API handle pointer

Returns
  int return code dirp_ret_code_e

## ◆ dirp_destroy()

dllexport int32_t dirp_destroy | ( | DIRP_HANDLE | h | ) |

Destroy the DIRP handle.

Parameters

  [in] | h | DIRP API handle

Returns
  int return code dirp_ret_code_e

## ◆ dirp_get_api_version()

dllexport int32_t dirp_get_api_version | ( | dirp_api_version_t * | version | ) |

Get API version.

Parameters

  [out] | version | DIRP API version information pointer

Returns
  int return code dirp_ret_code_e

## ◆ 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.

Parameters

  [in] | h | DIRP API handle
  [out] | color_bar | ISP color bar parameters pointer

Returns
  int return code dirp_ret_code_e

## ◆ 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.

In color bar automatic mode : manual_enable in dirp_color_bar_t is set as false. The inner ISP algorithm will calculate the best range values for color bar. Before calling this API you should call dirp_process once at least. And if any processing or measurement parameters had been changed, you should also call dirp_process again for getting new color bar adaptive parameters. In the above calling dirp_process, manual_enable in dirp_color_bar_t must be set as false.

Parameters

  [in] | h | DIRP API handle
  [out] | color_bar | ISP color bar parameters pointer

Returns
  int return code dirp_ret_code_e

## ◆ 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.

Parameters

  [in] | h | DIRP API handle
  [out] | enhancement_params | ISP enhancement parameters pointer

Returns
  int return code dirp_ret_code_e

## ◆ dirp_get_isotherm()

dllexport int32_t dirp_get_isotherm | ( | DIRP_HANDLE | h,
|  | dirp_isotherm_t * | isotherm
| ) |  |

Get orignial/custom ISP isotherm parameters.

Parameters

  [in] | h | DIRP API handle
  [out] | isotherm | ISP isotherm parameters pointer

Returns
  int return code dirp_ret_code_e

## ◆ 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.

Parameters

  [in] | h | DIRP API handle
  [out] | measurement_params | Temperature measurement parameters pointer

Returns
  int return code dirp_ret_code_e

## ◆ 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.

Parameters

  [in] | h | DIRP API handle
  [out] | params_range | Temperature measurement parameters range pointer

Returns
  int return code dirp_ret_code_e

## ◆ 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.

Parameters

  [in] | h | DIRP API handle
  [out] | raw_image | Original RAW image data buffer pointer
  [in] | size | Original RAW image data buffer size in bytes

Returns
  int return code dirp_ret_code_e

## ◆ 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.

Parameters

  [in] | h | DIRP API handle
  [out] | pseudo_color | ISP pseudo color type pointer dirp_pseudo_color_e

Returns
  int return code dirp_ret_code_e

## ◆ 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.

Parameters

  [in] | h | DIRP API handle
  [out] | pseudo_lut | ISP pseudo color LUT pointer

Returns
  int return code dirp_ret_code_e

## ◆ dirp_get_rjpeg_resolution()

dllexport int32_t dirp_get_rjpeg_resolution | ( | DIRP_HANDLE | h,
|  | dirp_resolution_t * | resolution
| ) |  |

Get R-JPEG image resolution information.

Parameters

  [in] | h | DIRP API handle
  [out] | rjpeg_info | R-JPEG basic information pointer

Returns
  int return code dirp_ret_code_e

## ◆ dirp_get_rjpeg_version()

dllexport int32_t dirp_get_rjpeg_version | ( | DIRP_HANDLE | h,
|  | dirp_rjpeg_version_t * | version
| ) |  |

Get R-JPEG version.

Parameters

  [in] | h | DIRP API handle
  [out] | version | R-JPEG version information pointer

Returns
  int return code dirp_ret_code_e

## ◆ 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.

Each INT16 pixel value represents ten times the temperature value in Celsius. In other words, each LSB represents 0.1 degrees Celsius. The custom measurement parameters can be modifed by this API:

- dirp_set_measurement_params

Parameters

  [in] | h | DIRP API handle
  [out] | temp_image | Temperature image data buffer pointer
  [in] | size | Temperature image data buffer size in bytes

Returns
  int return code dirp_ret_code_e

## ◆ 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.

Each FLOAT32 pixel value represents the real temperature in Celsius. The custom measurement parameters can be modifed by this API:

- dirp_set_measurement_params

Parameters

  [in] | h | DIRP API handle
  [out] | temp_image | Temperature image data buffer pointer
  [in] | size | Temperature image data buffer size in bytes

Returns
  int return code dirp_ret_code_e

## ◆ 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.

The ISP configurable parameters can be modifed by these APIs:

- dirp_set_enhancement_params
- dirp_set_isotherm
- dirp_set_color_bar
- dirp_set_pseudo_color

Parameters

  [in] | h | DIRP API handle
  [out] | color_image | Color image data buffer pointer
  [in] | size | Color image data buffer size in bytes.

Returns
  int return code dirp_ret_code_e

## ◆ 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.

The ISP strech configurable parameters can be modifed by these APIs:

- dirp_set_enhancement_params
- dirp_set_isotherm
- dirp_set_color_bar

Parameters

  [in] | h | DIRP API handle
  [out] | strech_image | Strech image data buffer pointer
  [in] | size | Strech image data buffer size in bytes.

Returns
  int return code dirp_ret_code_e

## ◆ 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.

Parameters

  [in] | h | DIRP API handle
  [in] | color_bar | ISP color bar parameters pointer

Returns
  int return code dirp_ret_code_e

## ◆ 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.

Parameters

  [in] | h | DIRP API handle
  [in] | enhancement_params | ISP enhancement parameters pointer

Returns
  int return code dirp_ret_code_e

## ◆ dirp_set_isotherm()

dllexport int32_t dirp_set_isotherm | ( | DIRP_HANDLE | h,
|  | const dirp_isotherm_t * | isotherm
| ) |  |

Set custom ISP isotherm parameters.

Parameters

  [in] | h | DIRP API handle
  [in] | isotherm | ISP isotherm parameters pointer

Returns
  int return code dirp_ret_code_e

## ◆ dirp_set_logger_file()

dllexport void dirp_set_logger_file | ( | const char * | file_name | ) |

Set external logger file.

Parameters

  [in] | file_name | File name which save log information. Set it as nullptr if you want print log on console.

## ◆ 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.

Parameters

  [in] | h | DIRP API handle
  [in] | measurement_params | Temperature measurement parameters pointer

Returns
  int return code dirp_ret_code_e

## ◆ 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.

Parameters

  [in] | h | DIRP API handle
  [in] | pseudo_color | ISP pseudo color type dirp_pseudo_color_e

Returns
  int return code dirp_ret_code_e

## ◆ dirp_set_verbose_level()

dllexport void dirp_set_verbose_level | ( | dirp_verbose_level_e | level | ) |

Set log print level.

Parameters

  [in] | level | Log pring level dirp_verbose_level_e