API and Feature Descriptions

The SDK version 4.x.x is compatible with and implements the core functional modules of the GenICam standard specification, including standardized feature naming conventions and unified parameter access interfaces.

Image Acquisition APIs

Load Library

ASSERT_OK( TYInitLib() );

Get SDK Version Info

TY_VERSION_INFO ver;
ASSERT_OK( TYLibVersion(&ver) );
LOGD("     - lib version: %d.%d.%d", ver.major, ver.minor, ver.patch);

Update Interface Status

LOGD("Update interface list");
ASSERT_OK( TYUpdateInterfaceList() );

Get Interface Count

uint32_t n = 0;
ASSERT_OK( TYGetInterfaceNumber(&n) );
LOGD("Got %u interface list", n);

Get Interface List

std::vector<TY_INTERFACE_INFO> ifaces(n);
ASSERT_OK( TYGetInterfaceList(&ifaces[0], n, &n) );
ASSERT( n == ifaces.size() );
for(uint32_t i = 0; i < n; i++)
{
    LOGI("Found interface %u:", i);
    LOGI("  name: %s", ifaces[i].name);
    LOGI("  id:   %s", ifaces[i].id);
    LOGI("  type: 0x%x", ifaces[i].type);
    if(TYIsNetworkInterface(ifaces[i].type))
    {
    LOGI("    MAC: %s", ifaces[i].netInfo.mac);
    LOGI("    ip: %s", ifaces[i].netInfo.ip);
    LOGI("    netmask: %s", ifaces[i].netInfo.netmask);
    LOGI("    gateway: %s", ifaces[i].netInfo.gateway);
    LOGI("    broadcast: %s", ifaces[i].netInfo.broadcast);
    }
}

Open Interface

If the network card’s MAC address is 88-a4-c2-b1-35-e3 and the IP address is 192.168.6.45 (stored in little-endian hexadecimal as 2d06a8c0), then the specified network card should be written as (Letter case matters) “eth-88-a4-c2-b1-35-e32d06a8c0”:

char* iface_id = "eth-88-a4-c2-b1-35-e32d06a8c0";
ASSERT_OK(TYOpenInterface(iface_id, &hIface));

Update Device List

The device information includes the following information:

typedef struct TY_DEVICE_BASE_INFO
{
    TY_INTERFACE_INFO   iface;
    char                id[32];///<device serial number
    char                vendorName[32];
    char                userDefinedName[32];
    char                modelName[32];///<device model name
    TY_VERSION_INFO     hardwareVersion; ///<deprecated
    TY_VERSION_INFO     firmwareVersion;///<deprecated
    union {
      TY_DEVICE_NET_INFO netInfo;
      TY_DEVICE_USB_INFO usbInfo;
    };
    char                buildHash[256];
    char                configVersion[256];
    char                reserved[256];
}TY_DEVICE_BASE_INFO;

Get Device Count

uint32_t n = 0;
TYGetDeviceNumber(hIface, &n);

Get Device List

std::vector<TY_DEVICE_BASE_INFO> devs(n);
TYGetDeviceList(hIface, &devs[0], n, &n);

Open Camera

ASSERT_OK( TYOpenDevice(hIface, selectedDev.id, &hDevice) );

Get Frame Buffer Size

Gets the framebuffer size required for the current device configuration.

uint32_t frameSize;
ASSERT_OK( TYGetFrameBufferSize(hDevice, &frameSize) );
LOGD("     - Get size of framebuffer, %d", frameSize);

Allocate and Enqueue Buffer

Pushes the allocated framebuffer into the buffer queue.

char* frameBuffer[2] = {0};
LOGD("     - Allocate & enqueue buffers");
frameBuffer[0] = new char[frameSize];
frameBuffer[1] = new char[frameSize];
LOGD("     - Enqueue buffer (%p, %d)", frameBuffer[0], frameSize);
ASSERT_OK( TYEnqueueBuffer(hDevice, frameBuffer[0], frameSize) );
LOGD("     - Enqueue buffer (%p, %d)", frameBuffer[1], frameSize);
ASSERT_OK( TYEnqueueBuffer(hDevice, frameBuffer[1], frameSize) );

Start Image Capture

LOGD("Start capture");
ASSERT_OK( TYStartCapture(hDevice) );

Fetch Frame Data

Waits for a valid frame data within the specified timeout period. If no frame is received before timeout expiration, the function will return and report an error status. Timeout unit: milliseconds (ms).

TYFetchFrame(hDevice, &frame, -1);

Stop Image Capture

TYStopCapture(hDevice);

Clear Buffer Queue

TYClearBufferQueue(hDevice);

Close Camera

TYCloseDevice(hDevice);

Close Interface

TYCloseInterface(hIface);

Unload Library

TYDeinitLib();

Log Setting APIs

Definition:

typedef enum TY_LOG_LEVEL_LIST
{
    TY_LOG_LEVEL_VERBOSE  = 1,
    TY_LOG_LEVEL_DEBUG    = 2,
    TY_LOG_LEVEL_INFO     = 3,
    TY_LOG_LEVEL_WARNING  = 4,
    TY_LOG_LEVEL_ERROR    = 5,
    TY_LOG_LEVEL_NEVER    = 9,
}TY_LOG_LEVEL_LIST;
typedef int32_t TY_LOG_LEVEL;

Set Log Level

The log level with the following priority hierarchy: VERBOSE DEBUG INFO WARNING ERROR.

// Set log level to DEBUG
ASSERT_OK(TYSetLogLevel(TY_LOG_LEVEL_DEBUG));

Set Log Prefix

Adds a customizable prefix to the logs to easily distinguish logs from different sources.

ASSERT_OK(TYSetLogPrefix("PERCIPIO SDK"));

Specify Log Level

Outputs logs of the specified level and below to the designated file.

ASSERT_OK(TYAppendLogToFile("test_log.txt", TY_LOG_LEVEL_DEBUG));

Send Log via TCP Protocol

Sends logs of the specified level and below to the designated server.

ASSERT_OK(TYAppendLogToServer("tcp", "192.168.2.70", 8000, TY_LOG_LEVEL_DEBUG));

Close Log Output

Closes the log file output and releases related resources.

ASSERT_OK(TYRemoveLogFile("test_log.txt"));

Stop Sending Log

Disconnects the TCP connection with the log server and stops log transmission.

ASSERT_OK(TYRemoveLogServer("tcp", "192.168.2.212", 8000));

Parameter Information Query APIs

Get Parameter Tool Tip

char str[1024];
ASSERT_OK(TYParamGetToolTip(hDevice,"Distortion",str,sizeof(str)));
std::cout << "ToolTip:" << str << std::endl;

Get Parameter Descriptor

char str[1024];
ASSERT_OK(TYParamGetDescriptor(hDevice,"Distortion",str,sizeof(str)));
std::cout << "Descriptor:" << str << std::endl;

Get Parameter Display Name

char str[1024];
ASSERT_OK(TYParamGetDisplayName(hDevice,"Distortion",str,sizeof(str)));
std::cout << "DisplayName:" << str << std::endl;

Get Parameter Data Type

Definition:

enum ParamType {
    Command,
    Integer,
    Float,
    Boolean,
    Enumeration,
    String,
    ByteArray,
};

The method to obtain the parameter data type is as follows:

ParamType type;
ASSERT_OK(TYParamGetType(hDevice,"User SetLoad",&type));
printf("Distortion type %d", type);

Query Parameter Access Permission

Definition:

typedef enum TY_ACCESS_MODE_LIST :uint32_t
{
    TY_ACCESS_READABLE          = 0x1,
    TY_ACCESS_WRITABLE          = 0x2,
}TY_ACCESS_MODE_LIST;
typedef uint8_t TY_ACCESS_MODE;

The method to obtain parameter access permission is as follows:

TY_ACCESS_MODE access_mode;
ASSERT_OK(TYParamGetAccess(hDevice, "DeviceFirmwareVersion", &access_mode));
printf("DeviceFirmwareVersion access mode %d\n", access_mode);

Get Parameter Visibility Type

Definition:

typedef enum TY_VISIBILITY_TYPE
{
    BEGINNER = 0,
    EXPERT = 1,
    GURU = 2,
    INVLISIBLE = 3
}TY_VISIBILITY_TYPE;

The method to obtain parameter visibility type is as follows:

TY_VISIBILITY_TYPE visibility;
ASSERT_OK(TYParamGetVisibility(hDevice, "DeviceFirmwareVersion", &visibility));
printf("DeviceFirmwareVersion visibility %d\n", visibility);

Device Control Features

Device control features provides general information and control for the device (camera) and its sensor. This is mainly used to identify the device during the enumeration process and to obtain information about the sensor resolution. Other information and controls pertaining to the general state of the device are also included in this category.

Get Camera Firmware Version

uint32_t len = 0;
TYStringGetLength(hDevice, "DeviceFirmwareVersion", &len);
std::string hash(len, '\0');
TYStringGetValue(hDevice, "DeviceFirmwareVersion", &hash[0], len);
std::cout << "DeviceFirmwareVersion: " << hash << std::endl;

Get Camera Hardware Version

uint32_t len = 0;
TYStringGetLength(hDevice, "DeviceHardwareVersion", &len);
std::string hash(len, '\0');
TYStringGetValue(hDevice, "DeviceHardwareVersion", &hash[0], len);
std::cout << "DeviceHardwareVersion: " << hash << std::endl;

Get Camera Version

uint32_t len = 0;
TYStringGetLength(hDevice, "DeviceVersion", &len);
std::string hash(len, '\0');
TYStringGetValue(hDevice, "DeviceVersion", &hash[0], len);
std::cout << "DeviceVersion: " << hash << std::endl;

Get Comprehensive Camera Firmware Information

uint32_t len = 0;
TYStringGetLength(hDevice, "DeviceBuildHash", &len);
std::string hash(len, '\0');
TYStringGetValue(hDevice, " DeviceBuildHash ", &hash[0], len);
std::cout << "DeviceVersion: " << hash << std::endl;

Get Camera Configuration Version

uint32_t len = 0;
TYStringGetLength(hDevice, "DeviceConfigVersion", &len);
std::string hash(len, '\0');
TYStringGetValue(hDevice, "DeviceConfigVersion", &hash[0], len);
std::cout << " DeviceConfigVersion: " << hash << std::endl;

Get Camera Technical Model

uint32_t len = 0;
TYStringGetLength(hDevice, "DeviceTechModel", &len);
std::string hash(len, '\0');
TYStringGetValue(hDevice, "DeviceTechModel", &hash[0], len);
std::cout << "DeviceTechModel: " << hash << std::endl;

Get Camera Serial Number

uint32_t len = 0;
TYStringGetLength(hDevice, "DeviceSerialNumber", &len);
std::string hash(len, '\0');
TYStringGetValue(hDevice, "DeviceSerialNumber", &hash[0], len);
std::cout << "DeviceSerialNumber: " << hash << std::endl;

Get Camera Vendor Name

uint32_t len = 0;
TYStringGetLength(hDevice, "DeviceVendorName", &len);
std::string hash(len, '\0');
TYStringGetValue(hDevice, "DeviceVendorName", &hash[0], len);
std::cout << "DeviceVendorName: " << hash << std::endl;

Get Camera Manufacturer Information

uint32_t len = 0;
TYStringGetLength(hDevice, "DeviceManufacturerInfo", &len);
std::string hash(len, '\0');
TYStringGetValue(hDevice, "DeviceManufacturerInfo", &hash[0], len);
std::cout << "DeviceManufacturerInfo: " << hash << std::endl;

Get Camera Model Name

uint32_t len = 0;
TYStringGetLength(hDevice, "DeviceModelName", &len);
std::string hash(len, '\0');
TYStringGetValue(hDevice, "DeviceModelName", &hash[0], len);
std::cout << "DeviceModelName: " << hash << std::endl;

Get Camera Manufacturing Time

uint32_t len = 0;
TYStringGetLength(hDevice, "DeviceGeneratedTime", &len);
std::string hash(len, '\0');
TYStringGetValue(hDevice, "DeviceGeneratedTime", &hash[0], len);
std::cout << "DeviceGeneratedTime: " << hash << std::endl;

Get Camera Calibration Time

uint32_t len = 0;
TYStringGetLength(hDevice, "DeviceCalibrationTime", &len);
std::string hash(len, '\0');
TYStringGetValue(hDevice, "DeviceCalibrationTime", &hash[0], len);
std::cout << "DeviceCalibrationTime: " << hash << std::endl;

Get Camera Network Connection Speed

int64_t speed = 0;
ASSERT_OK(TYIntegerGetValue(hDevice, "DeviceLinkSpeed", &speed));

Get / Set Camera Time Synchronization Mode

uint32_t _cnt = 0;
ASSERT_OK(TYEnumGetEntryCount(hDevice, "DeviceTimeSyncMode", &_cnt));
std::vector<TYEnumEntry> _cnt_entry(_cnt);
ASSERT_OK(TYEnumGetEntryInfo(hDevice, "DeviceTimeSyncMode", _cnt_entry.data(), _cnt, &_cnt));
for (int i = 0; i < _cnt; i++) {
    std::cout << "  Name : " << _cnt_entry[i].name << " value : " << _cnt_entry[i].value << std::endl;
}

//Set the camera's time synchronization mode and determine whether the time synchronization is successful.

ASSERT_OK(TYEnumSetString(hDevice, "DeviceTimeSyncMode", "SyncTypeNTP"));
bool sync_ready = false;
ASSERT_OK(TYBooleanGetValue(hDevice, "TimeSyncAck", &sync_ready));
while (!sync_ready) {
    ASSERT_OK(TYBooleanGetValue(hDevice, "TimeSyncAck", &sync_ready));
    MSLEEP(10);
}

Set NTP Time Synchronization Server

After setting the NTP server IP, when the camera’s time synchronization mode is set to SyncTypeNTP, it will synchronize time with the specified server.

ASSERT_OK(TYIntegerSetValue(hDevice, "NTPServerIP", 3232236033));//192.168.2.1

Get Camera Internal Temperature

uint32_t _cnt = 0;
ASSERT_OK(TYEnumGetEntryCount(hDevice, "DeviceTemperatureSelector", &_cnt));
std::vector<TYEnumEntry> _cnt_entry(_cnt);
ASSERT_OK(TYEnumGetEntryInfo(hDevice, "DeviceTemperatureSelector", _cnt_entry.data(), _cnt, &_cnt));
for (int i = 0; i < _cnt; i++) {
    std::cout << "  Name : " << _cnt_entry[i].name << " value : " << _cnt_entry[i].value << std::endl;
}

// Query the temperature of the specified component.
ASSERT_OK(TYEnumSetString(hDevice, "DeviceTemperatureSelector", "Color"));
double temperature = -1;
ASSERT_OK(TYFloatGetValue(hDevice, "DeviceTemperature", &temperature));

Camera Heartbeat Function

DeviceLinkHeartbeatMode

Maintains depth camera status. The SDK maintains a heartbeat link with the camera. Default value: On.

TYEnumSetString( hDevice, "DeviceLinkHeartbeatMode", "On");

DeviceLinkHeartbeatTimeout

Controls the current heartbeat timeout of the specific Link. If no link data is received within this time, the system determines that the link to the device is abnormal. Unit: ms.

int64_t min_Timeout, max_Timeout, Timeout_step,value_default,value_after;
ASSERT_OK(TYIntegerGetMin(hDevice, "DeviceLinkHeartbeatTimeout", &min_Timeout));
ASSERT_OK(TYIntegerGetMax(hDevice, "DeviceLinkHeartbeatTimeout", &max_Timeout));
ASSERT_OK(TYIntegerGetStep(hDevice, "DeviceLinkHeartbeatTimeout", &Timeout_step));
ASSERT_OK(TYIntegerGetValue(hDevice, "DeviceLinkHeartbeatTimeout", &value_default));
ASSERT_OK(TYIntegerSetValue(hDevice, "DeviceLinkHeartbeatTimeout", max_Timeout));
ASSERT_OK(TYIntegerGetValue(hDevice, "DeviceLinkHeartbeatTimeout", &value_after));
LOGD("DeviceLinkHeartbeatTimeout range: [%lld, %lld], step: %lld,default_value=%lld,new_value=%lld", min_Timeout, max_Timeout, Timeout_step, value_default,value_after);

Get / Set Device Frame Receive Timeout

After the camera has configured the data stream and resolution, it will automatically estimate a timeout value. If the host computer does not receive any data from the camera within this time, a timeout error will occur. The actual timeout used is determined as follows:

If the configured value is smaller than the estimated value, the estimated value will be used. If the configured value is larger than the estimated value, the configured value will be used.

char scr[1024];
ASSERT_OK(TYParamGetToolTip(hDevice, "DeviceFrameRecvTimeOut", scr, sizeof(scr)));
std::cout << "ToolTip:" << scr << std::endl;
int64_t min, max, step, value;
ASSERT_OK(TYIntegerGetValue(hDevice, "DeviceFrameRecvTimeOut", &value));
ASSERT_OK(TYIntegerGetMin(hDevice, "DeviceFrameRecvTimeOut", &min));
ASSERT_OK(TYIntegerGetMax(hDevice, "DeviceFrameRecvTimeOut", &max));
ASSERT_OK(TYIntegerGetStep(hDevice, "DeviceFrameRecvTimeOut", &step));
printf("DeviceFrameRecvTimeOut : [%d,%d] - %d,step %d\n", min, max, value,step);
ASSERT_OK(TYIntegerSetValue(hDevice, "DeviceFrameRecvTimeOut", value));

Reset Device Register

Reset the device to its power up state. This operation will also reset all User Set registers to their default values.

ASSERT_OK(TYCommandExec(hDevice, "DeviceReset"));

Acquisition Control Features

Acquisition control features govern the image acquisition related functions, including the trigger and exposure control. This section describes the basic model for acquisition and the typical behavior of the device.

Get Supported Camera Acquisition Modes

uint32_t _cnt = 0;
ASSERT_OK(TYEnumGetEntryCount(hDevice, "AcquisitionMode", &_cnt));
std::vector<TYEnumEntry> _cnt_entry(_cnt);
ASSERT_OK(TYEnumGetEntryInfo(hDevice, "AcquisitionMode", _cnt_entry.data(), _cnt, &_cnt));
for (int i = 0; i < _cnt; i++) {
    td::cout << "  Name : " << _cnt_entry[i].name << " value : " << _cnt_entry[i].value << std::endl;
}

Get Supported Camera Trigger Sources

uint32_t _cnt = 0;
ASSERT_OK(TYEnumGetEntryCount(hDevice, "TriggerSource", &_cnt));
std::vector<TYEnumEntry> _cnt_entry(_cnt);
ASSERT_OK(TYEnumGetEntryInfo(hDevice, "TriggerSource", _cnt_entry.data(), _cnt, &_cnt));
or (int i = 0; i < _cnt; i++) {
    td::cout << "  Name : " << _cnt_entry[i].name << " value : " << _cnt_entry[i].value << std::endl;
}

Set Acquisition Mode to Continuous

ASSERT_OK(TYEnumSetString(hDevice, "AcquisitionMode", "Continuous"));

Set Acquisition Mode to Software Trigger Mode

ASSERT_OK(TYEnumSetString(hDevice, "AcquisitionMode", "SingleFrame"));
//The trigger source is software trigger
ASSERT_OK(TYEnumSetString(hDevice, "TriggerSource", "Software"));
//Use this command to control image capture
ASSERT_OK(TYCommandExec(hDevice, "TriggerSoftware"));

Set Acquisition Mode to Hardware Trigger Mode

ASSERT_OK(TYEnumSetString(hDevice, "AcquisitionMode", "SingleFrame"));
//Trigger source is Line0
ASSERT_OK(TYEnumSetString(hDevice, "TriggerSource", "Line0"));

Get / Set Trigger Delay Time

Set the delay time from the camera receives the trigger signal to it starts exposure. Unit: μs. Maximum Value: 1300000.

double default,m_min, m_max, m_step;
ASSERT_OK(TYFloatGetValue(hDevice, "TriggerDelay", &default));
ASSERT_OK(TYFloatGetMin(hDevice, "TriggerDelay", &m_min));
ASSERT_OK(TYFloatGetMax(hDevice, "TriggerDelay", &m_max));
ASSERT_OK(TYFloatGetStep(hDevice, "TriggerDelay", &m_step));
LOGD("DTriggerDelay=%f,range=:%f - %f, step: %f",default, m_min, m_max, m_step);
ASSERT_OK(TYFloatSetValue(hDevice, "TriggerDelay", m_min));

Set Acquisition Frame Rate

Controls the acquisition rate (in Hertz) at which the frames are captured.

ASSERT_OK(TYEnumSetString(hDevice, "AcquisitionMode", "Continuous"));
ASSERT_OK(TYBooleanSetValue(hDevice, "AcquisitionFrameRateEnable", true));
ASSERT_OK(TYFloatSetValue(hDevice, "AcquisitionFrameRate", 2));

Set Trigger Level Duration Time

After the camera outputs the trigger signal, set the pulse width duration of the high/low level. Unit: μs.

ASSERT_OK(TYEnumSetString(hDevice, "AcquisitionMode", "Continuous"));
ASSERT_OK(TYBooleanSetValue(hDevice, "AcquisitionFrameRateEnable", true));
ASSERT_OK(TYFloatSetValue(hDevice, "AcquisitionFrameRate", 2));
ASSERT_OK(TYIntegerSetValue(hDevice, "TriggerDurationUs", 66000));

Transport Layer Control Features

Transport layer control features are mainly related to data packet size adjustment, packet loss detection, flow control, bandwidth limiting, and other functions.

Get / Set Maximum Transmission Packet Size

The size of the largest transmission unit on the link (stream channel) during data transmission of the network camera.

int64_t default_PacketSize,min_PacketSize, max_PacketSize, packet_step, value;
ASSERT_OK(TYIntegerGetValue(hDevice, "DeviceStreamChannelPacketSize", &default_PacketSize));
ASSERT_OK(TYIntegerGetMin(hDevice, "DeviceStreamChannelPacketSize", &min_PacketSize));
ASSERT_OK(TYIntegerGetMax(hDevice, "DeviceStreamChannelPacketSize", &max_PacketSize));
ASSERT_OK(TYIntegerGetStep(hDevice, "DeviceStreamChannelPacketSize", &packet_step));
//Set PacketSize
ASSERT_OK(TYIntegerSetValue(hDevice, "DeviceStreamChannelPacketSize", min_PacketSize));
ASSERT_OK(TYIntegerGetValue(hDevice, "DeviceStreamChannelPacketSize", &value));
LOGD("DeviceStreamChannelPacketSize default=%d range: [%lld, %lld], step: %lld,value=%lld", default_PacketSize, min_PacketSize, max_PacketSize, packet_step, value);

Get / Set Inter-Packet Delay (SCPD)

Controls the delay to insert between each packet for this stream channel. This can be used as a crude flow-control mechanism if the application or the network infrastructure cannot keep up with the packets coming from the device.

int64_t min_PacketDelay, max_PacketDelay, packet_step,value_default,value_after;
ASSERT_OK(TYIntegerGetMin(hDevice, "GevSCPD", &min_PacketDelay));
ASSERT_OK(TYIntegerGetMax(hDevice, "GevSCPD", &max_PacketDelay));
ASSERT_OK(TYIntegerGetStep(hDevice, "GevSCPD", &packet_step));
ASSERT_OK(TYIntegerGetValue(hDevice, "GevSCPD", &value_default));
//Set PacketDelayFeatures
ASSERT_OK(TYIntegerSetValue(hDevice, "GevSCPD", max_PacketDelay));
ASSERT_OK(TYIntegerGetValue(hDevice, "GevSCPD", &value_after));
LOGD("PacketDelay  range: [%lld, %lld], step: %lld,default_value=%lld,new_value=%lld", min_PacketDelay, max_PacketDelay, packet_step, value_default,value_after);

Get Current IP / Netmask / Gateway

Get the current IP / Netmask / Gateway of the camera.

int64_t CurrentIP, CurrentMask, CurrentGateWay;
CurrentIP = CurrentMask = CurrentGateWay = -1;
ASSERT_OK(TYIntegerGetValue(hDevice, "GevCurrentIPAddress", &CurrentIP));
ASSERT_OK(TYIntegerGetValue(hDevice, "GevCurrentSubnetMask", &CurrentMask));
ASSERT_OK(TYIntegerGetValue(hDevice, "GevCurrentDefaultGateway", &CurrentGateWay));
printf("CurrentIP %llu  CurrentMask %llu CurrentGateWay %llu\n", CurrentIP, CurrentMask, CurrentGateWay);

Set camera IP/Netmask/Gateway

Set the camera IP address to static. After configuration, reboot the camera for the changes to take effect.

ASSERT_OK(TYIntegerSetValue(hDevice, "GevPersistentIPAddress", 3232236220));//192.168.2.188
ASSERT_OK(TYIntegerSetValue(hDevice, "GevPersistentSubnetMask", 4294967040));//255.255.255.0
ASSERT_OK(TYIntegerSetValue(hDevice, "GevPersistentDefaultGateway", 3232236033));//192.168.2.1

Get Camera MAC Address

Read the camera’s MAC address. The retrieved value needs to be manually converted into the format XX:XX:XX:XX:XX:XX.

int64_t value;
ASSERT_OK(TYIntegerGetValue(hDevice, "GevMACAddress", &value));

Set / Get Image Synchronization

Set whether the left and right grayscale images are output synchronously. When the left and right images are completely synchronized, the frame rate of the image output is lower than when they are not completely synchronized.

   bool CmosSync,CmosSync_after;
   ASSERT_OK(TYBooleanGetValue(hDevice, "CmosSync", &CmosSync));
   LOGD("CmosSync=%d", CmosSync);
   ASSERT_OK(TYBooleanSetValue(hDevice, "CmosSync", 0));
   ASSERT_OK(TYBooleanGetValue(hDevice, "CmosSync", &CmosSync_after));
   LOGD("CmosSync_after=%d", CmosSync_after);


Asynchronous Data Stream Output

When the grayscale, color, and depth map data of a depth camera are output, it supports the immediate output of the acquired image data.

uint32_t _cnt = 0;
ASSERT_OK(TYEnumGetEntryCount(hDevice, "DeviceStreamAsyncMode", &_cnt));
std::vector<TYEnumEntry> _cnt_entry(_cnt);
ASSERT_OK(TYEnumGetEntryInfo(hDevice, "DeviceStreamAsyncMode", _cnt_entry.data(), _cnt, &_cnt));
std::cout << "DeviceStreamAsyncMode" << " has " << _cnt << " kinds of " << "DeviceStreamAsyncMode" << std::endl;
int32_t _value = -1;
ASSERT_OK(TYEnumGetValue(hDevice, "DeviceStreamAsyncMode", &_value));
std::cout << "  Default value : " << _value << std::endl;
for (int i = 0; i < _cnt; i++) {
    std::cout << "  Name : " << _cnt_entry[i].name << " value : " << _cnt_entry[i].value << std::endl;
}

Light Control Features

Light control features can be applied to dedicated Lighting Controller or to Cameras with integrated lighting control features.

Get Supported Camera Light Sources

Here, lightController0 refers to the laser, and LightController1 refers to the floodlight.

uint32_t _cnt = 0;
ASSERT_OK(TYEnumGetEntryCount(hDevice, "LightControllerSelector", &_cnt));
std::vector<TYEnumEntry> _cnt_entry(_cnt);
ASSERT_OK(TYEnumGetEntryInfo(hDevice, "LightControllerSelector", _cnt_entry.data(), _cnt, &_cnt));
std::cout << "LightControllerSelector" << " has " << _cnt << " kinds of " << "LightControllerSelector" << std::endl;
for (int i = 0; i < _cnt; i++) {
    std::cout << "  Name : " << _cnt_entry[i].name << " value : " << _cnt_entry[i].value << std::endl;
}

Enable Laser and Adjust Brightness

Enable the laser, read the range and adjustment step size of the laser brightness, and set the laser brightness accordingly.

//Select the laser
ASSERT_OK(TYEnumSetString(hDevice, "LightControllerSelector", "LightController0"));
//Enable laser
ASSERT_OK(TYBooleanSetValue(hDevice, "LightEnable", true));
int64_t min_brightness, max_brightness, step;
ASSERT_OK(TYIntegerGetMin(hDevice, "LightBrightness", &min_brightness));
ASSERT_OK(TYIntegerGetMax(hDevice, "LightBrightness", &max_brightness));
ASSERT_OK(TYIntegerGetStep(hDevice, "LightBrightness", &step));
LOGD("Laser brightness range: [%lld, %lld], step: %lld", min_brightness, max_brightness, step);
//Set laser brightness
ASSERT_OK(TYIntegerSetValue(hDevice, "LightBrightness", 100));

Get / Set Laser Work Mode

Get work modes supported by the laser and set its work mode.

Here, Sync indicates that both lasers flash simultaneously, Alternate indicates that the two lasers flash alternately, Left indicates that only the left laser is operating, and Right indicates that only the right laser is operating.

uint32_t _cnt = 0;
ASSERT_OK(TYEnumGetEntryCount(hDevice, "LaserWorkMode", &_cnt));
std::vector<TYEnumEntry> _cnt_entry(_cnt);
ASSERT_OK(TYEnumGetEntryInfo(hDevice, "LaserWorkMode", _cnt_entry.data(), _cnt, &_cnt));
std::cout << "LaserWorkMode" << " has " << _cnt << " kinds of " << "LaserWorkMode" << std::endl;
int32_t _value = -1;
ASSERT_OK(TYEnumGetValue(hDevice, "LaserWorkMode", &_value));
std::cout << "  Default value : " << _value << std::endl;
for (int i = 0; i < _cnt; i++) {
    std::cout << "  Name : " << _cnt_entry[i].name << " value : " << _cnt_entry[i].value << std::endl;
}
ASSERT_OK(TYEnumSetString(hDevice, "LaserWorkMode", _cnt_entry[0].name));

Enable Floodlight and Adjust Brightness

Enable the floodlight, read the range and adjustment step size of the floodlight brightness, and set the floodlight brightness accordingly.

//Select the floodlight
ASSERT_OK(TYEnumSetString(hDevice, "LightControllerSelector", "LightController1"));
//Enable floodlight
ASSERT_OK(TYBooleanSetValue(hDevice, "LightEnable", true));
int64_t min_brightness, max_brightness, step;
ASSERT_OK(TYIntegerGetMin(hDevice, "LightBrightness", &min_brightness));
ASSERT_OK(TYIntegerGetMax(hDevice, "LightBrightness", &max_brightness));
ASSERT_OK(TYIntegerGetStep(hDevice, "LightBrightness", &step));
LOGD("Laser brightness range: [%lld, %lld], step: %lld", min_brightness, max_brightness, step);
//Set floodlight brightness
ASSERT_OK(TYIntegerSetValue(hDevice, "LightBrightness", 100);

Source Control Features

Source control features include features related to multi-source acquisition devices. An example of such a multi-source device would be a stereo camera (visible and infra red light) that would transmit their data on a single camera’s physical connector but would have independent controllable features.

This section includes the following sensor components: Depth Image Sensor Component (Range), Color Image Sensor Component (Intensity), Left Monochrome Image Sensor Component (BinocularLeft), Right Monochrome Image Sensor Component (BinocularRight).

When configuring parameters under the Components, you must first switch the SourceSelector to the desired component.

ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "Range"));
ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "Intensity"));
ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "BinocularLeft"));
ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "BinocularRight"));

Get Supported Camera Components

uint32_t _cnt = 0;
ASSERT_OK(TYEnumGetEntryCount(hDevice, "SourceSelector", &_cnt));
std::vector<TYEnumEntry> _cnt_entry(_cnt);
ASSERT_OK(TYEnumGetEntryInfo(hDevice, "SourceSelector", _cnt_entry.data(), _cnt, &_cnt));
std::cout << "SourceSelector" << " has " << _cnt << " kinds of " << "SourceSelector" << std::endl;
for (int i = 0; i < _cnt; i++) {
    std::cout << "  Name : " << _cnt_entry[i].name << " value : " << _cnt_entry[i].value << std::endl;
}

Get / Set Image Format

//Select component
ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "Range"));
//Enable component
ASSERT_OK(TYBooleanSetValue(hDevice, "ComponentEnable", true));
uint32_t _cnt = 0;
ASSERT_OK(TYEnumGetEntryCount(hDevice, "PixelFormat", &_cnt));
std::vector<TYEnumEntry> _cnt_entry(_cnt);
ASSERT_OK(TYEnumGetEntryInfo(hDevice, "PixelFormat", _cnt_entry.data(), _cnt, &_cnt));
std::cout << "PixelFormat" << " has " << _cnt << " kinds of " << "PixelFormat" << std::endl;
for (int i = 0; i < _cnt; i++) {
    std::cout << "  Name : " << _cnt_entry[i].name << " value : " << _cnt_entry[i].value << std::endl;
}
ASSERT_OK(TYEnumSetString(hDevice, "PixelFormat", _cnt_entry[0].name));

Get / Set Image Resolution

After setting the image format, read the supported image resolutions and set to the specified resolution.

uint32_t _cnt0 = 0;
ASSERT_OK(TYEnumGetEntryCount(hDevice, "BinningHorizontal", &_cnt0));
std::vector<TYEnumEntry> _cnt_entry0(_cnt0);
ASSERT_OK(TYEnumGetEntryInfo(hDevice, "BinningHorizontal", _cnt_entry0.data(), _cnt0, &_cnt0));
std::cout << "BinningHorizontal" << " has " << _cnt0 << " kinds of " << "BinningHorizontal" << std::endl;
for (int i = 0; i < _cnt0; i++) {
    std::cout << "  Name : " << _cnt_entry0[i].name << " value : " << _cnt_entry0[i].value << std::endl;
}
ASSERT_OK(TYEnumSetString(hDevice, "BinningHorizontal", _cnt_entry0[0].name));

SGBM Features

Feature

Data Type

Description

DepthSgbmDisparityNumber

Integer

The disparity search range. The disparity search range of the matching window during the search process.

The larger the set value, the greater the measurement range in the Z direction of the camera, but the computing power will increase.

DepthSgbmDisparityOffset

Integer

The starting value for the disparity search.

The smaller the set value, the greater the maximum measurement value in the Z direction (Z max), meaning the measurement range is farther.

DepthSgbmMatchWinHeight

Integer

The height of the disparity matching window. The value must be odd.

DepthSgbmMatchWinWidth

Integer

The width of the disparity matching window. The value must be odd.

DepthSgbmImageNumber

Integer

The number of grayscale images for depth calculation.

The larger the set value, the better the quality of the output depth map, but the frame rate will decrease. The upper limit of the set value is influenced by the camera’s computing power.

DepthSgbmSemiParamP1

Integer

The penalty parameter P1 for disparity changes between neighboring pixels (+/-1).

The larger the set value, the smoother the depth map.

Adjusting this parameter helps prevent discontinuities or unreasonable depth values, effectively suppressing noise and discontinuities.

DepthSgbmSemiParamP1Scale

Integer

Sets the scaling factor for the penalty parameter P1 for disparity changes between neighboring pixels (+/-1).

DepthSgbmSemiParamP2

Integer

Sets the penalty parameter P2 for disparity changes between surrounding pixels.

The larger the value, the smoother the depth map. P2 > P1.

This parameter effectively handles texture-rich areas, reducing the number of mismatches.

DepthSgbmUniqueFactor

Integer

One of the uniqueness check parameters, which is the percentage of the best and second-best match points.

The larger the set value, the more unique the matching cost, and the larger the value, the more error match points are filtered out.

DepthSgbmUniqueAbsDiff

Integer

One of the uniqueness check parameters, which is the absolute difference between the best and second-best match points.

The larger the set value, the more unique the matching cost, and the larger the value, the more error match points are filtered out.

DepthSgbmHFilterHalfWin

Boolean

Search filter switch.

Further optimizes the depth map, removing noise and discontinuities, and making the point cloud at object edges more accurate.

DepthSgbmMedFilter

Boolean

Median filter switch.

Used to eliminate isolated noise points while preserving the edge information of the image as much as possible.

DepthSgbmMedFilterThresh

Integer

Median filter threshold.

The larger the set value, the more noise will be filtered out, but it may also result in the loss of detailed information in the depth map.

DepthSgbmLRC

Boolean

Left and right consistency check switch.

DepthSgbmLRCDiff

Integer

Left and right consistency check parameters.

When performing stereo matching, for pixels on the same object surface, the disparity of matching from the left image to the right image is LR, and the disparity of matching from the right image to the left image is RL. If ABS(LR-RL) < max LRC diff, then the point is considered a reliable match point.

The smaller the parameter setting value for left and right consistency check, the more reliable the matching.。

DepthSgbmTextureFilterThreshold

Integer

Sets the threshold for the texture feature.

It is used to optimize the edge detection for the depth maps, decrease noise within the point cloud and minimizing measurement errors.

  • For Integer SGBM parameters, the configurable range and adjustment step size can be read and set as follows:

    Replace cfg.feature_name.c_str() in the code with the desired parameter name to configure.

int64_t min, max, step, default_value;
min = max = step = default_value = -1;
ASSERT_OK(TYIntegerGetMin(hDevice, cfg.feature_name.c_str(), &min));
ASSERT_OK(TYIntegerGetMax(hDevice, cfg.feature_name.c_str(), &max));
ASSERT_OK(TYIntegerGetStep(hDevice, cfg.feature_name.c_str(), &step));
ASSERT_OK(TYIntegerGetValue(hDevice, cfg.feature_name.c_str(), &default_value));
std::cout << cfg.feature_name.c_str() << " : [" << min << "," << max << "] -- " << step << " ,default : " << default_value << std::endl;
ASSERT_OK(TYIntegerSetValue(hDevice, cfg.feature_name.c_str(), min+step));
  • For Boolean SGBM parameters, the configurable range and adjustment step size can be read and set as follows:

    Replace cfg.feature_name.c_str() in the code with the desired parameter name to configure.

ASSERT_OK(TYBooleanSetValue(hDevice, cfg.feature_name.c_str(), true));

Get / Set Depth Scale Unit

When the set value is not 1.0, the product of the data value of each pixel in the depth map and the scale unit gives the actual measured distance. Unit: mm. Select and enable component

This value affects the final depth result. If the value is too small, it may lead to errors in the depth calculation. If the value is too large, it may reduce the accuracy of the depth calculation.

//Set Component
ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "Range"));

double  Suint_out = -1, Suint_min = -1, Suint_max = -1, Suint_step = -1;
ASSERT_OK(TYFloatGetValue(hDevice, "DepthScaleUnit", &Suint_out));
ASSERT_OK(TYFloatGetMin(hDevice, "DepthScaleUnit", &Suint_min));
ASSERT_OK(TYFloatGetMax(hDevice, "DepthScaleUnit", &Suint_max));
ASSERT_OK(TYFloatGetStep(hDevice, "DepthScaleUnit", &Suint_step));
LOGD(" get value=%f, range: %f-%f,step:%f\n", Suint_out, Suint_min, Suint_max, Suint_step);

Set Depth Effective Range

Pixels with values lower than the minimum threshold will be set to 0 and excluded from subsequent calculation.

Pixels with values larger than the maximum threshold will be set to 0 and excluded from subsequent calculation.

ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "Range"));
ASSERT_OK(TYBooleanSetValue(hDevice, "ComponentEnable", true));
ASSERT_OK(TYIntegerSetValue(hDevice, "DepthRangeMin", 500));
ASSERT_OK(TYIntegerSetValue(hDevice, "DepthRangeMax", 1500));

Set Auto-Exposure

Automatic exposure switch for image sensor components. The optical components of some depth camera models support automatic image exposure.

//Set Component
ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "Intensity"));
ASSERT_OK(TYBooleanSetValue(hDevice, "ComponentEnable", true));
ASSERT_OK(TYBooleanSetValue(hDevice, "ExposureAuto", true));

Set Automatic White Balance

The automatic white balance control applies to color image sensors, which adjusts the R, G, B digital gain to achieve color space balance. Before setting the R, G, B digital gain, you need to turn off the automatic white balance function, otherwise the setting will not take effect.

//Set Component
ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "Intensity"));
ASSERT_OK(TYBooleanSetValue(hDevice, "BalanceWhiteAuto", true));

Get / Set Auto-Exposure Target Illuminance

Adjusting the target brightness is crucial when optimizing the color image quality in high contrast scenes. If the region of interest is relatively darker than other areas, increase the target brightness until details in that area become visible. Conversely, if the region of interest is relatively brighter, decrease the target brightness to reveal the details within that area.

//Select & enable component
ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "Intensity"));
ASSERT_OK(TYBooleanSetValue(hDevice, "ComponentEnable", true));
ASSERT_OK(TYBooleanSetValue(hDevice, "ExposureAuto", true));
int64_t min, max, step, default_value;
min = max = step = default_value = -1.0;
ASSERT_OK(TYIntegerGetMin(hDevice, "ExposureTargetBrightness", &min));
ASSERT_OK(TYIntegerGetMax(hDevice, "ExposureTargetBrightness", &max));
ASSERT_OK(TYIntegerGetStep(hDevice, "ExposureTargetBrightness", &step));
ASSERT_OK(TYIntegerGetValue(hDevice, "ExposureTargetBrightness", &default_value));
std::cout << "ExposureTargetBrightness" << " : [" << min << "," << max << "] -- " << step << " ,default : " << default_value << std::endl;
ASSERT_OK(TYIntegerSetValue(hDevice, "ExposureTargetBrightness", 4000));

Get / Set Exposure Time

The adjustable range of exposure time varies with different image sensors and frame rate configurations. Before setting the exposure time, Please disable auto-exposure if supported.

//Select & enable component
ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "Intensity"));
ASSERT_OK(TYBooleanSetValue(hDevice, "ComponentEnable", true));
//Disable auto-exposure
ASSERT_OK(TYBooleanSetValue(hDevice, "ExposureAuto", false));
double fmin, fmax, fstep, fdefault_value;
fmin = fmax = fstep = fdefault_value = -1.0f;
ASSERT_OK(TYFloatGetMin(hDevice, "ExposureTime", &fmin));
ASSERT_OK(TYFloatGetMax(hDevice, "ExposureTime", &fmax));
ASSERT_OK(TYFloatGetStep(hDevice, "ExposureTime", &fstep));
ASSERT_OK(TYFloatGetValue(hDevice, "ExposureTime", &fdefault_value));
std::cout << "ExposureTime" << " : [" << fmin << "," << fmax << "] -- " << fstep << " ,default : " << fdefault_value << std::endl;
ASSERT_OK(TYFloatSetValue(hDevice, "ExposureTime", 100.5));

Get / Set Analog Gain

The adjustable range of analog gain varies depending on different image sensors. Before setting the analog gain, please disable auto-exposure if supported.

ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "Intensity"));
ASSERT_OK(TYBooleanSetValue(hDevice, "ComponentEnable", true));
ASSERT_OK(TYBooleanSetValue(hDevice, "ExposureAuto", false));
double fmin, fmax, fstep, fdefault_value;
fmin = fmax = fstep = fdefault_value = -1.0f;
ASSERT_OK(TYEnumSetString(hDevice, "GainSelector", "AnalogAll"));
ASSERT_OK(TYFloatGetMin(hDevice, "Gain", &fmin));
ASSERT_OK(TYFloatGetMax(hDevice, "Gain", &fmax));
ASSERT_OK(TYFloatGetStep(hDevice, "Gain", &fstep));
ASSERT_OK(TYFloatGetValue(hDevice, "Gain", &fdefault_value));
std::cout << "Gain" << " : [" << fmin << "," << fmax << "] -- " << fstep << " ,default : " << fdefault_value <<
std::endl;
ASSERT_OK(TYFloatSetValue(hDevice, "Gain", 65535));

Get / Set Digital Gain

The digital gain of the color image sensor component needs to be independently set for the R, G, and B channels. Before setting the digital gain, please disable the AWB function if supported.

ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "Intensity"));
uint32_t _cnt = 0;
ASSERT_OK(TYEnumGetEntryCount(hDevice, "GainSelector", &_cnt));
std::vector<TYEnumEntry> _cnt_entry(_cnt);
ASSERT_OK(TYEnumGetEntryInfo(hDevice, "GainSelector", _cnt_entry.data(), _cnt, &_cnt));
std::cout << "GainSelector" << " has " << _cnt << " kinds of " << "GainSelector" << std::endl;
int32_t _value = -1;
ASSERT_OK(TYEnumGetValue(hDevice, "GainSelector", &_value));
std::cout << " Default value : " << _value << std::endl;
for (int i = 0; i < _cnt; i++) {
std::cout << " Name : " << _cnt_entry[i].name << " value : " << _cnt_entry[i].value << std::endl;
}
double min, max, value;
ASSERT_OK(TYEnumSetString(hDevice, "GainSelector", "DigitalRed"));
ASSERT_OK(TYFloatGetMin(hDevice, "Gain", &min));
ASSERT_OK(TYFloatGetMax(hDevice, "Gain", &max));
ASSERT_OK(TYFloatGetValue(hDevice, "Gain", &value));
printf("DigitalRed : [%f,%f] --- %d\n", min, max, value);
ASSERT_OK(TYFloatSetValue(hDevice, "Gain", min));
ASSERT_OK(TYEnumSetString(hDevice, "GainSelector", "DigitalGreen"));
ASSERT_OK(TYFloatGetMin(hDevice, "Gain", &min));
ASSERT_OK(TYFloatGetMax(hDevice, "Gain", &max));
ASSERT_OK(TYFloatGetValue(hDevice, "Gain", &value));
printf("DigitalRed : [%f,%f] --- %d\n", min, max, value);
ASSERT_OK(TYFloatSetValue(hDevice, "Gain", min));
ASSERT_OK(TYEnumSetString(hDevice, "GainSelector", "DigitalBlue"));
ASSERT_OK(TYFloatGetMin(hDevice, "Gain", &min));
ASSERT_OK(TYFloatGetMax(hDevice, "Gain", &max));
ASSERT_OK(TYFloatGetValue(hDevice, "Gain", &value));
printf("DigitalRed : [%f,%f] --- %d\n", min, max, value);
ASSERT_OK(TYFloatSetValue(hDevice, "Gain", max));

Enable Undistortion

The default value of the undistortion function for the monosensor is false, which means the infrared image sensor component outputs image data without undistortion by default.

ASSERT_OK(TYBooleanSetValue(hDevice, "IRUndistortion", true));

User Set Control Features

User Set control features mainly include features for global control of the device settings. It allows loading or saving factory or user-defined settings. Loading the factory default User Set guarantees a state where a continuous acquisition can be started using only the mandatory features.

The User Sets are divided into two categories:

  • Default User Set: This category includes a total of 8 User Sets(default0 to default7). These User Sets are pre-set at the factory. They can be loaded and used but their parameters and descriptions cannot be modified.

  • Customized User Set: This category includes the other 8 User Sets (user set8 to user set15). These User Sets are initially empty. Users can customize and save parameters to these User Sets, offering flexible adaptation to user-specific requirements (e.g., archiving scene-specific configurations).

Read Current User Set

Reads the User Set currently used by the camera.

int64_t current_set = -1;
ASSERT_OK(TYIntegerGetValue(hDevice, "User SetCurrent", &current_set));
printf("User SetCurrent is %d\n", current_set);

Load User Set

//Get Camera User Set Count
TY_ACCESS_MODE access;
uint32_t _cnt = 0;
ASSERT_OK(TYEnumGetEntryCount(hDevice, "User SetSelector", &_cnt));
std::vector<TYEnumEntry> _cnt_entry(_cnt);
ASSERT_OK(TYEnumGetEntryInfo(hDevice, "User SetSelector", _cnt_entry.data(), _cnt, &_cnt));
std::cout << "User SetSelector" << " has " << _cnt << " kinds of " << "User SetSelector" << std::endl;
for (int i = 0; i < _cnt; i++) {
ASSERT_OK(TYEnumSetValue(hDevice, "User SetSelector", _cnt_entry[i].value));
ASSERT_OK(TYParamGetAccess(hDevice, "User SetLoad", &access));
if (access) {
std::cout << " Name : " << _cnt_entry[i].name << " value : " << _cnt_entry[i].value << " can be
loaded!" << std::endl;
}
}
//Select User Set to load
ASSERT_OK(TYEnumSetValue(hDevice, "User SetSelector", _cnt_entry[0].value));
//Load User Set
ASSERT_OK(TYCommandExec(hDevice, "User SetLoad"));

Get / Set User Set Description

The User Set Description of Default User Sets cannot be modified.

//Set
ASSERT_OK(TYStringSetValue(hDevice, "User SetDescription", "hahahahaha"));
//Read&write
uint32_t len = 0;
ASSERT_OK(TYStringGetLength(hDevice, "User SetDescription", &len));
std::string hash(len, '\0');
ASSERT_OK(TYStringGetValue(hDevice, "User SetDescription", &hash[0], len));
std::cout << "User SetDescription : " << hash << std::endl;

Save User Set

Save the User Set specified by User SetSelector to the non-volatile memory of the device. Before executing User SetSave, a description must be set first.

ASSERT_OK(TYEnumSetValue(hDevice, "User SetSelector", 8));
ASSERT_OK(TYStringSetValue(hDevice, "User SetDescription", "hahahahaha"));
ASSERT_OK(TYCommandExec(hDevice, "User SetSave"));

Set Default User Set

ASSERT_OK(TYEnumSetValue(hDevice, "User SetDefault", 0));

Camera Calibration Features

Get Sensor Width / Height

int64_t width, height;
ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "Range"));
ASSERT_OK(TYIntegerGetValue(hDevice, "IntrinsicWidth", &width));
ASSERT_OK(TYIntegerGetValue(hDevice, "IntrinsicHeight", &height));

Get Intrinsic Matrix

ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "Range"));
double mat_intr_3x3[9];
ASSERT_OK(TYByteArrayGetValue(hDevice, "Intrinsic", reinterpret_cast<uint8_t*>(mat_intr_3x3),
sizeof(mat_intr_3x3)));
std::cout << "\t\t" << std::setw(12) << std::setfill(' ') << std::fixed << std::setprecision(6) << mat_intr_3x3[0]
<< std::setw(12) << mat_intr_3x3[1]
<< std::setw(12) << mat_intr_3x3[2] << std::endl;
std::cout << "\t\t" << std::setw(12) << std::setfill(' ') << std::fixed << std::setprecision(6) << mat_intr_3x3[3]
<< std::setw(12) << mat_intr_3x3[4]
<< std::setw(12) << mat_intr_3x3[5] << std::endl;
std::cout << "\t\t" << std::setw(12) << std::setfill(' ') << std::fixed << std::setprecision(6) << mat_intr_3x3[6]
<< std::setw(12) << mat_intr_3x3[7]
<< std::setw(12) << mat_intr_3x3[8] << std::endl;

Get Rectified Intrinsic Matrix

ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "BinocularLeft"));
double mat_intr_3x3[9];
ASSERT_OK(TYByteArrayGetValue(hDevice, "Intrinsic2", reinterpret_cast<uint8_t*>(mat_intr_3x3),
sizeof(mat_intr_3x3)));
std::cout << "\t\t" << std::setw(12) << std::setfill(' ') << std::fixed << std::setprecision(6) << mat_intr_3x3[0]
<< std::setw(12) << mat_intr_3x3[1]
<< std::setw(12) << mat_intr_3x3[2] << std::endl;
std::cout << "\t\t" << std::setw(12) << std::setfill(' ') << std::fixed << std::setprecision(6) << mat_intr_3x3[3]
<< std::setw(12) << mat_intr_3x3[4]
<< std::setw(12) << mat_intr_3x3[5] << std::endl;
std::cout << "\t\t" << std::setw(12) << std::setfill(' ') << std::fixed << std::setprecision(6) << mat_intr_3x3[6]
<< std::setw(12) << mat_intr_3x3[7]
<< std::setw(12) << mat_intr_3x3[8] << std::endl;

Get Extrinsic Matrix

ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "Intensity"));
double mat_extrinsic_4x4[16];
ASSERT_OK(TYByteArrayGetValue(hDevice, "Extrinsic", reinterpret_cast<uint8_t*>(mat_extrinsic_4x4),
sizeof(mat_extrinsic_4x4)));
std::cout << "\t\t" << std::setw(12) << std::setfill(' ') << std::fixed << std::setprecision(6) << mat_extrinsic_4x4[0]
<< std::setw(12) << mat_extrinsic_4x4[1]
<< std::setw(12) << mat_extrinsic_4x4[2]
<< std::setw(12) << mat_extrinsic_4x4[3] << std::endl;
std::cout << "\t\t" << std::setw(12) << std::setfill(' ') << std::fixed << std::setprecision(6) << mat_extrinsic_4x4[4]
<< std::setw(12) << mat_extrinsic_4x4[5]
<< std::setw(12) << mat_extrinsic_4x4[6]
<< std::setw(12) << mat_extrinsic_4x4[7] << std::endl;
std::cout << "\t\t" << std::setw(12) << std::setfill(' ') << std::fixed << std::setprecision(6) << mat_extrinsic_4x4[8]
<< std::setw(12) << mat_extrinsic_4x4[9]
<< std::setw(12) << mat_extrinsic_4x4[10]
<< std::setw(12) << mat_extrinsic_4x4[11] << std::endl;
std::cout << "\t\t" << std::setw(12) << std::setfill(' ') << std::fixed << std::setprecision(6) << mat_extrinsic_4x4[12]
<< std::setw(12) << mat_extrinsic_4x4[13]
<< std::setw(12) << mat_extrinsic_4x4[14]
<< std::setw(12) << mat_extrinsic_4x4[15] << std::endl;

Get Rotation Matrix

ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "BinocularLeft"));
double mat_rotation_3x3[9];
ASSERT_OK(TYByteArrayGetValue(hDevice, "Rotation", reinterpret_cast<uint8_t*>(mat_rotation_3x3),
sizeof(mat_rotation_3x3)));
std::cout << "\t\t" << std::setw(12) << std::setfill(' ') << std::fixed << std::setprecision(6) << mat_rotation_3x3[0]
<< std::setw(12) << mat_rotation_3x3[1]
<< std::setw(12) << mat_rotation_3x3[2] << std::endl;
std::cout << "\t\t" << std::setw(12) << std::setfill(' ') << std::fixed << std::setprecision(6) << mat_rotation_3x3[3]
<< std::setw(12) << mat_rotation_3x3[4]
<< std::setw(12) << mat_rotation_3x3[5] << std::endl;
std::cout << "\t\t" << std::setw(12) << std::setfill(' ') << std::fixed << std::setprecision(6) << mat_rotation_3x3[6]
<< std::setw(12) << mat_rotation_3x3[7]
<< std::setw(12) << mat_rotation_3x3[8] << std::endl;

Get Distortion Matrix

ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "BinocularLeft"));
double mat_distortion_12x1[12];
ASSERT_OK(TYByteArrayGetValue(hDevice, "Distortion", reinterpret_cast<uint8_t*>(mat_distortion_12x1),
sizeof(mat_distortion_12x1)));
std::cout << std::fixed << std::setprecision(6) << "\t\t";
for (size_t i = 0; i < sizeof(mat_distortion_12x1) / sizeof(double); i++) {
std::cout << std::setw(12) << mat_distortion_12x1[i];
}
std::cout << std::endl;