C++ API References

TOFCamera

namespace Arducam
class ArducamTOFCamera
#include <ArducamTOFCamera.hpp>

Camera application layer class, used to manage the camera and process frame data.

Public Functions

TofErrorCode open(Connection mode, const int index = 0)

Initialize the camera configuration and turn on the camera, set the initialization frame according to the mode

Parameters:
  • mode – [in] Specify the connection method.

  • index – [in] Device node, the default value is video0.

Returns:

An ErrorCode.

TofErrorCode openWithFile(const char *path, const int index = 0)

Initialize the camera configuration and turn on the camera, set the initialization frame according to the path

Parameters:
  • path – [in] Specify the camera configuration file path.

  • index – [in] Device node, the default value is video0.

Returns:

An ErrorCode.

TofErrorCode close()

close the camera

Returns:

An ErrorCode.

TofErrorCode start(FrameType type = FrameType::DEPTH_FRAME)

Start the camera stream and start processing.

Parameters:

type – Specify the camera output format. This parameter can be one of the following values:

  • RAW_FRAME

  • DEPTH_FRAME

Returns:

An ErrorCode.

TofErrorCode stop()

Stop camera stream and processing.

Returns:

An ErrorCode.

TofErrorCode setControl(Control mode, int value)

Set camera parameters.

Returns:

An ErrorCode.

TofErrorCode setControlExt(Control mode, const char *value)

Set camera parameters.

Returns:

An ErrorCode.

TofErrorCode getControl(Control mode, int *value)

Get camera parameters.

Returns:

An ErrorCode.

TofErrorCode getControlExt(Control mode, const char **value)

Get camera parameters.

Returns:

An ErrorCode.

TofErrorCode writeSensor(uint32_t addr, uint32_t val)

Write Sensor Register.

Returns:

An ErrorCode.

TofErrorCode readSensor(uint32_t addr, uint32_t &val)

Read Sensor Register.

Returns:

An ErrorCode.

CameraInfo getCameraInfo() const

Get the Camera frames format.

Returns:

All frame data formats contained in frame, The returned value include: width, height and Frametype

ArducamFrameBuffer *requestFrame(int16_t timeout)

Request a frame of data from the frame processing thread.

Parameters:

timeout – Timeout time, -1 if wait indefinitely, 0 if immediate, other values indicate the maximum waiting time, in milliseconds.

Returns:

ArducamTOFFrame class address.

TofErrorCode releaseFrame(ArducamFrameBuffer *frame)

Free the memory space of the frame.

Parameters:

frame – The address of the frame to be released

Returns:

An ErrorCode.

FrameBuffer

namespace Arducam
class ArducamFrameBuffer
#include <ArducamTOFData.hpp>

AbstractData.

Subclassed by Arducam::CacheData, Arducam::DepthData, Arducam::RawData

Public Functions

virtual void *getData(FrameType type) = 0

Get the Pointer of Frame Data.

Parameters:

type – [in] Specify the frame data type. This parameter can be one of the following values:

  • RAW_FRAME

  • CONFIDENCE_FRAME

  • DEPTH_FRAME

Returns:

Return Pointer of Frame Data.The returned pointer type can be one of the following type:

  • int16_t* : RAW_FRAME

  • float* : DEPTH_FRAME

  • float* : CONFIDENCE_FRAME

virtual TofErrorCode getFormat(FrameType type, FrameFormat &format) = 0

Specify the frame data type to get the frame data format.

Parameters:
  • type – [in] Specify the frame data type. This parameter can be one of the following values:

    • RAW_FRAME

    • CONFIDENCE_FRAME

    • DEPTH_FRAME

  • format – [out] Returns the frame data format of the specified frame type

Returns:

An ErrorCode.

Utils

namespace Arducam

Enums

enum TofErrorCode

Error code.

Values:

enumerator ArducamSuccess
enumerator ArducamInvalidParameter
enumerator ArducamNoCache
enumerator ArducamUnkownDevice
enumerator ArducamNotImplemented
enumerator ArducamSkipFrame
enumerator ArducamSystemError
enumerator ArducamUnkownError
enum Connection

camera connection method.

Values:

enumerator CSI
enumerator USB
enumerator CONNECT_COUNT
enum DeviceType

DeviceType.

Values:

enumerator DEVICE_VGA
enumerator DEVICE_HQVGA
enum FrameType

Some types of frame data.

Values:

enumerator RAW_FRAME
enumerator CONFIDENCE_FRAME
enumerator DEPTH_FRAME
enumerator AMPLITUDE_FRAME
enumerator CACHE_FRAME
enumerator FRAME_TYPE_COUNT
enum Control

Camera control type.

Values:

enumerator RANGE
enumerator FMT_WIDTH
enumerator FMT_HEIGHT
enumerator MODE
enumerator FRAME_MODE
enumerator EXPOSURE
enumerator FRAME_RATE
enumerator SKIP_FRAME
enumerator SKIP_FRAME_LOOP
enumerator AUTO_FRAME_RATE
enumerator INTRINSIC_FX

focal length in x direction, the real fx is this value / 100

enumerator INTRINSIC_FY

focal length in y direction, the real fy is this value / 100

enumerator INTRINSIC_CX

principal point in x direction, the real cx is this value / 100

enumerator INTRINSIC_CY

principal point in y direction, the real cy is this value / 100

enumerator DENOISE

denoise level

enumerator HFLIP
enumerator VFLIP
enumerator CONFIG_DIR_EXT
enumerator LOAD_CALI_DATA
enumerator SAVE_CALI_DATA
enumerator I2C_BY_PASS
enumerator I2C_BUS_NUM
enum TofWorkMode

Values:

enumerator SINGLE_FREQ

work with single frequency

enumerator DOUBLE_FREQ
enumerator TRIPLE_FREQ
enumerator QUAD_FREQ
enumerator DISTANCE

according to distance measurement parameters to choose parameters

enumerator HDR

configure chip to measure very near or far object (useful for AE)

enumerator AE
enumerator BG_OUTDOOR

configure chip to measure background IR radiation (no light from vcsel during phase frame)

enumerator GRAY_ONLY
enumerator CUSTOM1

for hw-cstar project

enumerator CUSTOM2
enumerator CUSTOM3
enum TofFrameWorkMode

Values:

enumerator SINGLE_FREQ_2PHASE
enumerator SINGLE_FREQ_4PHASE
enumerator SINGLE_FREQ_4PHASE_GRAY

whole frame: 4phase+gray

enumerator SINGLE_FREQ_4PHASE_BG

whole frame: 4phase+bg

enumerator SINGLE_FREQ_4PHASE_4BG

whole frame: 4phase+4bg

enumerator SINGLE_FREQ_4PHASE_GRAY_5BG

whole frame: 4phase+gray+5bg

enumerator SINGLE_FREQ_GRAY_BG_4PHASE_GRAY_BG
enumerator SINGLE_FREQ_GRAY_BG_4PHASE_BG
enumerator SINGLE_FREQ_BG_GRAY_BG_4PHASE
enumerator SINGLE_FREQ_BG_4PHASE_BG_GRAY
enumerator DOUBLE_FREQ_4PHASE

each frequency has 4phase, whole frame: 4phase+4phase

enumerator DOUBLE_FREQ_4PHASE_GRAY_4PHASE_BG

whole frame: (4phase+gray)+(4phase+bg)

enumerator DOUBLE_FREQ_4PHASE_4BG

whole frame: (4phase+4bg)+(4phase+4bg)

enumerator DOUBLE_FREQ_4PHASE_GRAY_5BG

whole frame: (4phase+gray+5bg)+(4phase+gray+5bg)

enumerator TRIPLE_FREQ_4PHASE

whole frame: (4phase)+(4phase)+(4phase)

enumerator TRIPLE_FREQ_4PHASE_GRAY_4PHASE_GRAY_4PHASE_BG

whole frame: (4phase+gray)+(4phase+gray)+(4phase+bg)

enumerator QUAD_FREQ_4PHASE

whole frame: (4phase)+(4phase)+(4phase)+(4phase)

enumerator QUAD_FREQ_4PHASE_GRAY_4PHASE_BG_4PHASE_GRAY_4PHASE_BG
enumerator BG_OUTDOOR
enumerator GRAY_ONLY
enumerator CUSTOM
enum Platform

Platform type.

Values:

enumerator Default
enumerator Windows
enumerator Jetson_Nano
enumerator Jetson_NX
enumerator Jetson_Other
enumerator Raspberry_Pi
enumerator Raspberry_Pi5
enumerator Radxa_Rock

Functions

const char *to_str(TofErrorCode error)
static inline constexpr int to_int(TofWorkMode mode)
static inline constexpr int to_int(TofFrameWorkMode mode)
struct CameraInfo
#include <ArducamTOFUnity.hpp>

Basic information of the camera module.

Public Members

unsigned int index
Connection connect
DeviceType device_type
FrameType type
unsigned int width
unsigned int height
unsigned int bit_width
unsigned int bpp
struct FrameFormat
#include <ArducamTOFUnity.hpp>

Description of frame data format.

Public Functions

inline bool operator==(const FrameFormat &rhs) const
inline bool operator!=(const FrameFormat &rhs) const
FrameFormat &operator=(const FrameFormat &src) = default

Public Members

unsigned int width

width of frame

unsigned int height

height of frame

FrameType type

type of frame

uint64_t timestamp

type of frame