API 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.

APIs Table

TYInitLib()

Loads library.

ASSERT_OK( TYInitLib() );

TYLibVersion()

Gets SDK version info.

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

TYUpdateInterfaceList()

Updates interface status.

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

TYGetInterfaceNumber()

Gets the number of interfaces.

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

TYGetInterfaceList()

Gets 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);
    }
}

TYOpenInterface()

Opens the specified interface.

For example, 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));

TYUpdateDeviceList()

Updates device list. For detailed usage, refer to the selectDevice() function in the program samples.

The device information is described as follows:

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;

TYGetDeviceNumber()

Gets device count.

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

TYGetDeviceList()

Gets device list.

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

TYOpenDevice()

Opens camera.

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

TYGetFrameBufferSize()

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);

TYEnqueueBuffer()

Allocates and pushes the allocated framebuffer into the buffer queue (enqueue buffer).

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) );

TYStartCapture()

Starts image capture.

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

TYFetchFrame()

Fetches frame data by waiting for the specified buffer to be filled within the given timeout. Returns an error status if no frame is received before the timeout expires. Timeout unit: milliseconds (ms).

TYFetchFrame(hDevice, &frame, -1);

Image Parsing

  1. ty_comp_window_name(): Generates a window title based on the componentID.

  2. ty_image_info(): Converts the SDK’s native image format into a parsable format.

  3. TYGetDecodeBufferSize(): Checks if the image format is compressed.

  4. TYGetDecodeTargetPixFmt(): Determines the target pixel format that the decode operation will produce, based on the input image format and the specified output configuration.

  5. TYDecodeImage(): Decompresses compressed data into raw pixels.

  6. TYDisplayImage(): Reads image information and creates a window to display the image.

for (int i = 0; i < frame.validCount; i++){
     if (frame.image[i].status != TY_STATUS_OK) continue;
     uint32_t destSize;
     auto win = ty_comp_window_name(frame.image[i].componentID);
     TYImageInfo image_info = ty_image_info(frame.image[i]);
     TYDecodeError err = TYGetDecodeBufferSize(&image_info, &destSize, TY_OUTPUT_FORMAT_AUTO);
     if(err == TY_DECODE_SUCCESS) {
         TYDecodeResult retInfo;
         std::vector<uint8_t> image_data(destSize);
         ASSERT_OK(TYDecodeImage(&image_info,  TY_OUTPUT_FORMAT_AUTO, (void*)&image_data[0], destSize, &retInfo));
         TYDisplayImage(win.c_str(), retInfo.width, retInfo.height, retInfo.format, &image_data[0]);
     } else {
         TYDisplayImage(win.c_str(), frame.image[i].width, frame.image[i].height, frame.image[i].pixelFormat, frame.image[i].buffer);
     }
 }

TYStopCapture()

Stops image capture.

TYStopCapture(hDevice);

TYClearBufferQueue()

Clears buffer queue.

TYClearBufferQueue(hDevice);

TYCloseDevice()

Closes camera.

TYCloseDevice(hDevice);

TYCloseInterface()

Closes interface.

TYCloseInterface(hIface);

TYDeinitLib()

Unloads library.

TYDeinitLib();

TYEnableLog()

Enables log output. The supported log output modes includes: STD (outputting to terminal), File (outputting to local file), and Server (outputting to server).

ASSERT_OK(TYEnableLog(TY_LOG_TYPE_STD));//outputs log to terminal
ASSERT_OK(TYEnableLog(TY_LOG_TYPE_FILE));//outputs log to local file
ASSERT_OK(TYEnableLog(TY_LOG_TYPE_SERVER));//outputs log to server

TYDisableLog()

Disables log output.

ASSERT_OK(TYDisableLog (TY_LOG_TYPE_STD));// disables outputting log to terminal
ASSERT_OK(TYDisableLog (TY_LOG_TYPE_FILE));//disables outputting log to local file
ASSERT_OK(TYDisableLog (TY_LOG_TYPE_SERVER));//disables outputting log to server

TYSetLogLevel()

Sets the output level for the logging system with the following priority hierarchy: VERBOSE DEBUG INFO WARNING ERROR.

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

Log level 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;

TYSetLogPrefix()

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

ASSERT_OK(TYSetLogPrefix("PERCIPIO SDK"));

TYCfgLogFile()

Applicable only when the log output mode is set to TY_LOG_TYPE_FILE. Configures the log file naming, size, and count. If not manually configured via TYCfgLogFile, logs will be automatically saved to percipio.log in the default path.

Method 1: Manually configure log file name, file size, and file count via TYCfgLogFile.

ASSERT_OK(TYEnableLog(TY_LOG_TYPE_FILE));
ASSERT_OK(TYSetLogLevel(TY_LOG_TYPE_FILE, TY_LOG_LEVEL_ERROR));
ASSERT_OK(TYCfgLogFile("2025109log.txt",100000,10));

Where,

  • 100000 represents the size of each file (default value: 10 Mb) is 100000 bit.

  • 10 represents the max log file number (Default value: 10) to retain is 10.

Method 2: Output logs to percipio.log in the default path.

ASSERT_OK(TYEnableLog(TY_LOG_TYPE_FILE));
ASSERT_OK(TYSetLogLevel(TY_LOG_TYPE_FILE, TY_LOG_LEVEL_ERROR));
LOGD("Path is :%s", std::getenv("TEMP"));
//LOGD("Path is :%s", std::getenv("TMP"));
//LOGD("Path is :%s", std::getenv("TMPDIR") );

Where,

  • On Windows systems, use LOGD("Path is :%s", std::getenv("TEMP")); or LOGD("Path is :%s", std::getenv("TMP")); to get the default path.

  • On Linux systems, use LOGD("Path is :%s", std::getenv("TMPDIR") ); to get the default path.

TYCfgLogServer()

Applicable only when the log output mode is set to TY_LOG_TYPE_SERVER. Sets the type, IP address and terminal number of the server. The supported server types include TY_SERVER_TYPE_UDP and TY_SERVER_TYPE_TCP.

ASSERT_OK(TYEnableLog(TY_LOG_TYPE_SERVER));
ASSERT_OK(TYCfgLogServer(TY_SERVER_TYPE_TCP,"192.168.6.77", 8000));
ASSERT_OK(TYSetLogLevel(TY_LOG_TYPE_SERVER, TY_LOG_LEVEL_ERROR));

TYParamExist()

Checks whether a specific feature or parameter is supported by the camera.

bool exist = false;
TYParamExist(hDevice, "TriggerSoftware", &exist);
printf("This feature is: %d\n", exist);

TYParamGetToolTip()

Gets parameter tool tip.

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

TYParamGetDescriptor()

Gets parameter descriptor.

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

TYParamGetDisplayName()

Gets parameter display name.

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

TYParamGetType()

Gets parameter data type.

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

Parameter type definition:

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

TYParamGetAccess()

Queries parameter access permission.

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

Access mode 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;

TYParamGetVisibility()

Gets parameter visibility type.

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

Parameter visibility definition:

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

TYFloatGetUnit

Gets unit for the float feature.

The following float features support unit retrieval.

Feature Name

Unit

DeviceTemperature

C

ExposureTime

us

int64_t min_brightness, max_brightness, step;
ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "Texture"));
ASSERT_OK(TYBooleanSetValue(hDevice, "ComponentEnable", true));
ASSERT_OK(TYBooleanSetValue(hDevice, "ExposureAuto", false));
char unit[1024];
ASSERT_OK(TYFloatGetUnit(hDevice, "ExposureTime", unit, sizeof(unit)));
printf("ExposureTime unit : %s\n", unit);

TYIntegerGetUnit

Gets unit for the integer feature.

char unit[1024];
ASSERT_OK(TYIntegerGetUnit(hDevice, "DeviceLinkSpeed", unit, sizeof(unit)));
printf("DeviceLinkSpeed unit : %s\n", unit);

The following integer features support unit retrieval.

Feature Name

Unit

DepthRangeMin

mm

DepthRangeMax

mm

DeviceLinkHeartbeatTimeout

ms

DeviceFrameRecvTime0ut

ms

DeviceLinkSpeed

Mbps

Feature Operation APIs (for Gige_2.1 Cameras)

  1. Command Features

    Provides the following interface:

    TY_CAPI  TYCommandExec                  (TY_DEV_HANDLE hDevice, const char* feat);
    

    Usage example:

    //Control camera image capture with this command
    ASSERT_OK(TYCommandExec(hDevice, "TriggerSoftware"));
    
  2. Integer Features

    Provides the following interface:

    TY_CAPI  TYIntegerSetValue              (TY_DEV_HANDLE hDevice, const char* feat, int64_t value);
    TY_CAPI  TYIntegerGetValue              (TY_DEV_HANDLE hDevice, const char* feat, int64_t* value);
    TY_CAPI  TYIntegerGetMin                (TY_DEV_HANDLE hDevice, const char* feat, int64_t* min);
    TY_CAPI  TYIntegerGetMax                (TY_DEV_HANDLE hDevice, const char* feat, int64_t* max);
    TY_CAPI  TYIntegerGetStep               (TY_DEV_HANDLE hDevice, const char* feat, int64_t* step);
    TY_CAPI  TYIntegerGetUnit               (TY_DEV_HANDLE hDevice, const char* feat, char* pBuffer, uint32_t bufferSize);
    

    Usage example:

    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 value
    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);
    
  3. Float Features

    Provides the following interface:

    TY_CAPI  TYFloatSetValue                (TY_DEV_HANDLE hDevice, const char* feat, double value);
    TY_CAPI  TYFloatGetValue                (TY_DEV_HANDLE hDevice, const char* feat, double* value);
    TY_CAPI  TYFloatGetMin                  (TY_DEV_HANDLE hDevice, const char* feat, double* min);
    TY_CAPI  TYFloatGetMax                  (TY_DEV_HANDLE hDevice, const char* feat, double* max);
    TY_CAPI  TYFloatGetStep                 (TY_DEV_HANDLE hDevice, const char* feat, double* step);
    TY_CAPI  TYFloatGetUnit                 (TY_DEV_HANDLE hDevice, const char* feat, char* pBuffer, uint32_t bufferSize);
    

    Usage example:

    //Set component
    ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "Depth"));
    
    double  Suint_out = -1, Suint_min = -1, Suint_max = -1, Suint_step = -1, value;
    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));
    
    //Set DepthScaleUnit value
    ASSERT_OK(TYFloatSetValue(hDevice, "DepthScaleUnit", Suint_max));
    ASSERT_OK(TYFloatGetValue(hDevice, "DepthScaleUnit", &value));
    LOGD(" get value=%f, range: %f-%f,step:%f\n", Suint_out, Suint_min, Suint_max, Suint_step, value);
    
  4. Boolean Features

    Provides the following interface:

    TY_CAPI  TYBooleanSetValue              (TY_DEV_HANDLE hDevice, const char* feat, bool value);
    TY_CAPI  TYBooleanGetValue              (TY_DEV_HANDLE hDevice, const char* feat, bool* value);
    

    Usage example:

    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);
    
  5. Enum Features

    Provides the following interface:

    TY_CAPI  TYEnumSetValue                 (TY_DEV_HANDLE hDevice, const char* feat, int32_t value);
    TY_CAPI  TYEnumSetString                (TY_DEV_HANDLE hDevice, const char* feat, const char* name);
    TY_CAPI  TYEnumGetValue                 (TY_DEV_HANDLE hDevice, const char* feat, int32_t* value);
    TY_CAPI  TYEnumGetString                (TY_DEV_HANDLE hDevice, const char* feat, char* name, const uint32_t length);
    TY_CAPI  TYEnumGetEntryCount            (TY_DEV_HANDLE hDevice, const char* feat, uint32_t* cnt);
    TY_CAPI  TYEnumGetEntryInfo             (TY_DEV_HANDLE hDevice, const char* feat, TYEnumEntry* pEnumEntry, uint32_t entryCount, uint32_t* pFilledEntryCount);
    

    Usage example:

    //Set component
    ASSERT_OK(TYEnumSetString(hDevice, "SourceSelector", "Depth"));
    //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));
    
  6. String Features

    Provides the following interface:

    TY_CAPI  TYStringSetValue               (TY_DEV_HANDLE hDevice, const char* feat, const char* pBuffer);
    TY_CAPI  TYStringGetLength              (TY_DEV_HANDLE hDevice, const char* feat, uint32_t* pLength);
    TY_CAPI  TYStringGetValue               (TY_DEV_HANDLE hDevice, const char* feat, char* pBuffer, uint32_t bufferSize);
    

    Usage example:

    //Set
    ASSERT_OK(TYStringSetValue(hDevice, "UserSetDescription", "hahahahaha"));
    //Read
    uint32_t len = 0;
    ASSERT_OK(TYStringGetLength(hDevice, "UserSetDescription", &len));
    std::string hash(len, '\0');
    ASSERT_OK(TYStringGetValue(hDevice, "UserSetDescription", &hash[0], len));
    std::cout << "UserSetDescription : " << hash << std::endl;
    
  7. ByteArray Features

    Provides the following interface:

    TY_CAPI  TYByteArrayGetSize             (TY_DEV_HANDLE hDevice, const char* feat, uint32_t* pSize);
    TY_CAPI  TYByteArraySetValue            (TY_DEV_HANDLE hDevice, const char* feat, const uint8_t* pBuffer, uint32_t bufferSize);
    TY_CAPI  TYByteArrayGetValue            (TY_DEV_HANDLE hDevice, const char* feat, uint8_t* buffer, uint32_t bufferSize);
    

    Usage example:

    ::

    //Required headers: #include <iomanip>

    ASSERT_OK(TYEnumSetString(hDevice, “SourceSelector”, “Texture”)); //Read extrinsic matrix double mat_extrinsic_4x4[16]; ASSERT_OK(TYByteArrayGetValue(hDevice, “Extrinsic”, reinterpret_cast<uint8_t*>(mat_extrinsic_4x4), sizeof(mat_extrinsic_4x4))); std::cout << “tt” << 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 << “tt” << 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 << “tt” << 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 << “tt” << 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;

TYHasFeature

Input device handle and component ID to check if the feature corresponding to featureID is supported.

bool HasFeature =false;
ASSERT_OK(TYHasFeature(hDevice, TY_COMPONENT_IR_CAM_LEFT,TY_INT_EXPOSURE_TIME , &HasFeature));
LOGD("TY_ENUM_TEMPERATURE_ID%10s%d","", HasFeature);

TYGetFeatureInfo

Input device handle and component ID to query information about the feature corresponding to featureID.

Feature information includes: access attributes (read, write), support for runtime configuration during image capture, and the component and other feature IDs associated with this feature.

typedef struct TY_FEATURE_INFO
{
    bool            isValid;            ///< true if feature exists, false otherwise
    TY_ACCESS_MODE  accessMode;         ///< feature access privilege
    bool            writableAtRun;      ///< feature can be written while capturing
    char            reserved0[1];
    TY_COMPONENT_ID componentID;        ///< owner of this feature
    TY_FEATURE_ID   featureID;          ///< feature unique id
    char            name[32];           ///< describe string
    int32_t         bindComponentID;    ///< component ID current feature bind to
    int32_t         bindFeatureID;      ///< feature ID current feature bind to
    char            reserved[252];
}TY_FEATURE_INFO;

Example:

TY_FEATURE_INFO info;
ASSERT_OK(TYGetFeatureInfo(hDevice, TY_COMPONENT_IR_CAM_LEFT, TY_INT_EXPOSURE_TIME, &info));
LOGD("TY_INT_EXPOSURE_TIME name %s",info.name);
LOGD("TY_INT_EXPOSURE_TIME featureID = 0x%04" PRIx32, info.featureID);
LOGD("TY_INT_EXPOSURE_TIME componentID= 0x%08" PRIx32,info.componentID);

Feature Operation APIs (for Gige_2.0 Cameras)

  1. Int Features

    Provides the following interface:

    TY_CAPI             TYGetIntRange             (TY_DEV_HANDLE hDevice, TY_COMPONENT_ID componentID, TY_FEATURE_ID featureID, TY_INT_RANGE* intRange);
    TY_CAPI             TYGetInt                  (TY_DEV_HANDLE hDevice, TY_COMPONENT_ID componentID, TY_FEATURE_ID featureID, int32_t* value);
    TY_CAPI             TYSetInt                  (TY_DEV_HANDLE hDevice, TY_COMPONENT_ID componentID, TY_FEATURE_ID featureID, int32_t value);
    

    Usage example:

    ASSERT_OK(TYSetInt(hDevice, TY_COMPONENT_DEVICE, TY_INT_ACCEPTABLE_PERCENT, 90));
    
  2. Float Features

    Provides the following interface:

    TY_CAPI             TYGetFloatRange           (TY_DEV_HANDLE hDevice, TY_COMPONENT_ID componentID, TY_FEATURE_ID featureID, TY_FLOAT_RANGE* floatRange);
    TY_CAPI             TYGetFloat                (TY_DEV_HANDLE hDevice, TY_COMPONENT_ID componentID, TY_FEATURE_ID featureID, float* value);
    TY_CAPI             TYSetFloat                (TY_DEV_HANDLE hDevice, TY_COMPONENT_ID componentID, TY_FEATURE_ID featureID, float value);
    

    Usage example:

    float value = 0.25;
    ASSERT_OK(TYSetFloat(hDevice, TY_COMPONENT_DEPTH_CAM, TY_FLOAT_SCALE_UNIT,value));
    
  3. Enum Features

    Provides the following interface:

    TY_CAPI             TYGetEnumEntryCount       (TY_DEV_HANDLE hDevice, TY_COMPONENT_ID componentID, TY_FEATURE_ID featureID, uint32_t* entryCount);
    TY_CAPI             TYGetEnumEntryInfo        (TY_DEV_HANDLE hDevice, TY_COMPONENT_ID componentID, TY_FEATURE_ID featureID, TY_ENUM_ENTRY* entries, uint32_t entryCount, uint32_t* filledEntryCount);
    TY_CAPI             TYGetEnum                 (TY_DEV_HANDLE hDevice, TY_COMPONENT_ID componentID, TY_FEATURE_ID featureID, int32_t* value);
    TY_CAPI             TYSetEnum                 (TY_DEV_HANDLE hDevice, TY_COMPONENT_ID componentID, TY_FEATURE_ID featureID, int32_t value);
    

    Usage example:

    ASSERT_OK(TYSetEnum(hDevice, TY_COMPONENT_DEVICE, TY_ENUM_STREAM_ASYNC, TY_STREAM_ASYNC_RGB));
    
  4. Bool Features

    Provides the following interface:

    TY_CAPI             TYGetBool                 (TY_DEV_HANDLE hDevice, TY_COMPONENT_ID componentID, TY_FEATURE_ID featureID, bool* value);
    TY_CAPI             TYSetBool                 (TY_DEV_HANDLE hDevice, TY_COMPONENT_ID componentID, TY_FEATURE_ID featureID, bool value);
    

    Usage example:

    ASSERT_OK(TYSetBool(hDevice, TY_COMPONENT_DEVICE, TY_BOOL_GVSP_RESEND, true));
    
  5. String Features

    Provides the following interface:

    TY_CAPI             TYGetStringLength         (TY_DEV_HANDLE hDevice, TY_COMPONENT_ID componentID, TY_FEATURE_ID featureID, uint32_t* length);
    TY_CAPI             TYGetString               (TY_DEV_HANDLE hDevice, TY_COMPONENT_ID componentID, TY_FEATURE_ID featureID, char* buffer, uint32_t bufferSize);
    TY_CAPI             TYSetString               (TY_DEV_HANDLE hDevice, TY_COMPONENT_ID componentID, TY_FEATURE_ID featureID, const char* buffer);
    
  6. Struct Features

    Provides the following interface:

    TY_CAPI             TYGetStruct               (TY_DEV_HANDLE hDevice, TY_COMPONENT_ID componentID, TY_FEATURE_ID featureID, void* pStruct, uint32_t structSize);
    TY_CAPI             TYSetStruct               (TY_DEV_HANDLE hDevice, TY_COMPONENT_ID componentID, TY_FEATURE_ID featureID, void* pStruct, uint32_t structSize);
    

    Usage example:

    TY_AEC_ROI_PARAM roi;
    roi.x = 0;
    roi.y = 0;
    roi.w = 100;
    roi.h = 100;
    ASSERT_OK(TYSetStruct(hDevice, TY_COMPONENT_RGB_CAM, TY_STRUCT_AEC_ROI, &roi, sizeof(roi)));
    

TYUndistortImage2()

Performs IR image undistortion for the V-series camera.

TY_CAMERA_ROTATION cameraRotation;
TY_CAMERA_INTRINSIC cameraRectifiedIntrinsic;
TYLensOpticalType lens = TY_LENS_PINHOLE;
TY_CAMERA_CALIB_INFO ir_calib_info;
TYGetStruct(hDevice, TY_COMPONENT_IR_CAM_LEFT, TY_STRUCT_CAM_RECTIFIED_ROTATION, &cameraRotation, sizeof(cameraRotation));
TYGetStruct(hDevice, TY_COMPONENT_IR_CAM_LEFT, TY_STRUCT_CAM_RECTIFIED_INTRI, &cameraRectifiedIntrinsic, sizeof(cameraRectifiedIntrinsic));
TYGetStruct(hDevice, TY_COMPONENT_IR_CAM_LEFT, TY_STRUCT_CAM_CALIB_DATA, &ir_calib_info, sizeof(ir_calib_info));
TY_IMAGE_DATA src;
src.width = irl.cols;
src.height = irl.rows;
src.size = ir_image_size;
src.pixelFormat = fmt;
src.buffer = irl.data;
TY_IMAGE_DATA dst;
dst.width = irl.cols;
dst.height = irl.rows;
dst.size = ir_image_size;
dst.pixelFormat = fmt;
dst.buffer = rectified_ir.data;
ASSERT_OK(TYUndistortImage2 (&ir_calib_info,&src,&cameraRotation,&cameraRectifiedIntrinsic,&dst,lens));