yangsy
About 2380 wordsAbout 8 min
2024-06-06
//Get the SDK version number
//@ param [in/out] nLength Character length
//@ param [in/out] pstrSDKVersion SDK version number string pointer
//@ return Error code
SYErrorCode GetSDKVersion(int& nLength, char* pstrSDKVersion = nullptr);
//Initialize the SDK
//@ return Error code
SYErrorCode InitSDK();
//Uninitialize the SDK, release resources
//@ return Error code
SYErrorCode UnInitSDK();
//Find devices
//@ param [in/out] nCount Number of devices
//@ param [in/out] pDevice Device information, allocate memory externally, pass nullptr to pDevice to only get nCount
//@ return Error code
SYErrorCode FindDevice(int& nCount, SYDeviceInfo* pDevice = nullptr);
//Open device
//@ param [in] deviceInfo Device information
//@ return Error code
SYErrorCode OpenDevice(const SYDeviceInfo& deviceInfo);
//Close device
//@ param [in] nDeviceID Device ID
//@ return Error code
SYErrorCode CloseDevice(unsigned int nDeviceID);
//Query device support types
//@ param [in] nDeviceID Device ID
//@ param [in/out] nCount Number of supported data frame types, pSupportType is used for returning the count when it's nullptr, otherwise it's for verifying the memory allocation size
//@ param [in/out] pSupportType Supported types, allocate memory externally, pass nullptr to pSupportType to only get nCount
//@ return Error code
SYErrorCode QueryDeviceSupportFrameType(unsigned int nDeviceID, int& nCount, SYSupportType * pSupportType = nullptr);
//Query device supported frame resolutions
//@ param [in] nDeviceID Device ID
//@ param [in] supportType Frame type
//@ param [in/out] nCount Number of supported resolutions, pResolution is used for returning the count when it's nullptr, otherwise it's for verifying the memory allocation size
//@ param [in/out] pResolution Supported resolution types, allocate memory externally, pass nullptr to pResolution to only get nCount
//@ return Error code
SYErrorCode QueryDeviceSupportResolution(unsigned int nDeviceID, SYSupportType supportType, int& nCount, SYResolution* pResolution = nullptr);
//Get current stream type
//@ param [in] nDeviceID Device ID
//@ return Current stream type
SYStreamType GetCurrentStreamType(unsigned int nDeviceID);
//Start data stream
//@ param [in] nDeviceID Device ID
//@ param [in] streamType Data stream type
//@ return Error code
SYErrorCode StartStreaming(unsigned int nDeviceID, SYStreamType streamType);
//Stop data stream
//@ param [in] nDeviceID Device ID
//@ return Error code
SYErrorCode StopStreaming(unsigned int nDeviceID);
//Change data stream
//@ param [in] nDeviceID Device ID
//@ param [in] streamType Data stream type
//@ return Error code
SYErrorCode ChangeStreaming(unsigned int nDeviceID, SYStreamType streamType);
//Set resolution (If the data stream has been started, the internal process will close the stream -> set resolution -> reopen the stream)
//@ param [in] nDeviceID Device ID
//@ param [in] frameType Frame type
//@ param [in] resolution Frame resolution
//@ return Error code
SYErrorCode SetFrameResolution(unsigned int nDeviceID, SYFrameType frameType, SYResolution resolution);
//Get device frame resolution
//@ param [in] nDeviceID Device ID
//@ param [in] frameType Frame type
//@ param [out] resolution Frame resolution
//@ return Error code
SYErrorCode GetFrameResolution(unsigned int nDeviceID, SYFrameType frameType, SYResolution& resolution);
//Get depth corresponding pseudo color
//@ param [in] nDeviceID Device ID
//@ param [in] nCount Data count (memory space pDepth needs nCount*2 bytes, pColor needs nCount*3 bytes)
//@ param [in] pDepth Depth data
//@ param [in/out] pColor Depth corresponding pseudo color (24-bit RGB format)
//@ return Error code
SYErrorCode GetDepthColor(unsigned int nDeviceID, int nCount, const unsigned short* pDepth, unsigned char* pColor);
//Get depth corresponding point cloud data
//@ param [in] nDeviceID Device ID
//@ param [in] nWidth Width
//@ param [in] nHeight Height
//@ param [in] pDepth Depth data
//@ param [in/out] pPointCloud Depth corresponding point cloud data, allocate memory externally
//@ param [in] bUndistort Cropping flag, true-cropping false-no cropping
//@ return Error code
SYErrorCode GetDepthPointCloud(unsigned int nDeviceID, int nWidth, int nHeight, const unsigned short* pDepth, SYPointCloudData* pPointCloud, bool bUndistort = false);
//Get RGBD
//@ param [in] nDeviceID Device ID
//@ param [in] nSourceDepthWidth Source depth data width
//@ param [in] nSourceDepthHeight Source depth data height
//@ param [in] pSourceDepth Source depth data
//@ param [in] nSourceRGBWidth Source RGB data width
//@ param [in] nSourceRGBHeight Source RGB data height
//@ param [in] pSourceRGB Source RGB data
//@ param [in] nTargetWidth RGBD data width
//@ param [in] nTargetHeight RGBD data height
//@ param [in/out] pTargetDepth Depth data in RGBD, allocate memory externally, data length is consistent with source RGB length
//@ param [in/out] pTargetRGB RGB data in RGBD, allocate memory externally, data length is consistent with source RGB length
//@ return Error code
SYErrorCode GetRGBD(unsigned int nDeviceID, int nSourceDepthWidth, int nSourceDepthHeight, unsigned short* pSourceDepth, int nSourceRGBWidth, int nSourceRGBHeight, unsigned char* pSourceRGB, int nTargetWidth, int nTargetHeight, unsigned short* pTargetDepth, unsigned char* pTargetRGB);
//Get the latest frame data
//@ param [in] nDeviceID Device ID
//@ param [in/out] pFrameData The latest frame data
//@ return Error code
SYErrorCode GetLastFrameData(unsigned int nDeviceID, SYFrameData*& pFrameData);
//Get filtering status
//@ param [in] nDeviceID Device ID
//@ param [out] bFilter Filtering status, true-filtering is enabled, false-filtering is not enabled
//@ return Error code
SYErrorCode GetFilter(unsigned int nDeviceID, bool& bFilter);
//Enable/disable filtering
//@ param [in] nDeviceID Device ID
//@ param [in] bFilter Filtering switch, true-enable filtering, false-disable filtering
//@ return Error code
SYErrorCode SetFilter(unsigned int nDeviceID, bool bFilter);
//Get hardware filtering mode status
//@ param [in] nDeviceID Device ID
//@ param [out] bHardwareFilterMode Hardware filtering mode status, true-hardware filtering mode is enabled, false-hardware filtering mode is not enabled
//@ return Error code
SYErrorCode GetHardWareFilterMode(unsigned int nDeviceID, bool& bHardwareFilterMode);
//Enable/disable hardware filtering mode
//@ param [in] nDeviceID Device ID
//@ param [in] bHardwareFilterMode Hardware filtering mode status, true-enable hardware filtering mode, false-disable hardware filtering mode
//@ return Error code
SYErrorCode SetHardWareFilterMode(unsigned int nDeviceID, bool bHardwareFilterMode);
//Hardware filtering mode availability
//@ param [in] nDeviceID Device ID
//@ param [in] bHaveHardwareFilterMode Hardware filtering mode availability flag, true-available, false-unavailable
//@ return Error code
SYErrorCode HaveHardWareFilterMode(unsigned int nDeviceID, bool& bHaveHardwareFilterMode);
//Get filtering list
//@ param [in] nDeviceID Device ID
//@ param [in/out] nCount Filtering list length
//@ param [in/out] pFilterType Filtering list
//@ return Error code
SYErrorCode GetFilterList(unsigned int nDeviceID, int& nCount, SYFilterType* pFilterType = nullptr);
//Set default filtering
//@ param [in] nDeviceID Device ID
//@ return Error code
SYErrorCode SetDefaultFilter(unsigned int nDeviceID);
//Add filtering
//@ param [in] nDeviceID Device ID
//@ param [in] filterType Filtering type
//@ return Error code
SYErrorCode AddFilter(unsigned int nDeviceID, SYFilterType filterType);
//Remove filtering
//@ param [in] nDeviceID Device ID
//@ param [in] nIndex Filtering list index
//@ return Error code
SYErrorCode DeleteFilter(unsigned int nDeviceID, int nIndex);
//Clear filtering
//@ param [in] nDeviceID Device ID
//@ return Error code
SYErrorCode ClearFilter(unsigned int nDeviceID);
//Set filtering parameters
//@ param [in] nDeviceID Device ID
//@ param [in] filterType Filtering type
//@ param [in] nParamCount Number of filtering parameters
//@ param [in] pFilterParam Filtering parameters
//@ return Error code
SYErrorCode SetFilterParam(unsigned int nDeviceID, SYFilterType filterType, int nParamCount, float* pFilterParam);
//Get filtering parameters
//@ param [in] nDeviceID Device ID
//@ param [in] filterType Filtering type
//@ param [in/out] nParamCount Number of filtering parameters
//@ param [in/out] pFilterParam Filtering parameters
//@ return Error code
SYErrorCode GetFilterParam(unsigned int nDeviceID, SYFilterType filterType, int& nParamCount, float* pFilterParam = nullptr);
//Get trail filtering status
//@ param [in] nDeviceID Device ID
//@ param [out] bFilter Trail filtering status, true-filtering is enabled, false-filtering is not enabled
//@ return Error code
SYErrorCode GetTrailFilter(unsigned int nDeviceID, bool& bFilter);
//Enable/disable trail filtering
//@ param [in] nDeviceID Device ID
//@ param [in] bFilter Trail filtering switch, true-enable filtering, false-disable filtering
//@ return Error code
SYErrorCode SetTrailFilter(unsigned int nDeviceID, bool bFilter);
Info
Supported after SDK version v4.2.3.0
//Use IR to filter depth data
//@ param [in] nDeviceID Device ID
//@ param [in/out] pDepth Depth data pointer
//@ param [in] pIR IR data pointer
//@ param [in] nWidth Data width
//@ param [in] nHeight Data height
//@ param [in] nThreshold IR threshold
SYErrorCode IRFilter(unsigned int nDeviceID, unsigned short* pDepth, unsigned short* pIR, int nWidth, int nHeight, int nThreshold);
//Get horizontal mirror status
//@ param [in] nDeviceID Device ID
//@ param [out] bMirror Horizontal mirror status, true-horizontal mirror is enabled, false-horizontal mirror is not enabled
//@ return Error code
SYErrorCode GetMirror(unsigned int nDeviceID, bool& bMirror);
//Enable/disable horizontal mirror
//@ param [in] nDeviceID Device ID
//@ param [in] bMirror Horizontal mirror switch, true-enable horizontal mirror, false-disable horizontal mirror
//@ return Error code
SYErrorCode SetMirror(unsigned int nDeviceID, bool bMirror);
//Get vertical flip status
//@ param [in] nDeviceID Device ID
//@ param [out] bFlip Vertical flip status, true-vertical flip is enabled, false-vertical flip is not enabled
//@ return Error code
SYErrorCode GetFlip(unsigned int nDeviceID, bool& bFlip);
//Enable/disable vertical flip
//@ param [in] nDeviceID Device ID
//@ param [in] bFlip Vertical flip switch, true-enable vertical flip, false-disable vertical flip
//@ return Error code
SYErrorCode SetFlip(unsigned int nDeviceID, bool bFlip);
//Get integration time
//@ param [in] nDeviceID Device ID
//@ param [out] nIntegralTime Integration time
//@ return Error code
SYErrorCode GetIntegralTime(unsigned int nDeviceID, int& nIntegralTime);
//Set integration time
//@ param [in] nDeviceID Device ID
//@ param [in] nIntegralTime Integration time
//@ return Error code
SYErrorCode SetIntegralTime(unsigned int nDeviceID, int nIntegralTime);
//Get integration time range
//@ param [in] nDeviceID Device ID
//@ param [in] depthResolution Depth resolution
//@ param [out] nMin Minimum integration time
//@ param [out] nMax Maximum integration time
//@ return Error code
SYErrorCode GetIntegralTimeRange(unsigned int nDeviceID, SYResolution depthResolution, int& nMin, int& nMax);
//Get ranging measure range
//@ param [in] nDeviceID Device ID
//@ param [out] nMin Minimum ranging value
//@ param [out] nMax Maximum ranging value
//@ return Error code
SYErrorCode GetDistanceMeasureRange(unsigned int nDeviceID, int& nMin, int& nMax);
//Get user ranging range
//@ param [in] nDeviceID Device ID
//@ param [out] nMin Minimum user ranging value
//@ param [out] nMax Maximum user ranging value
//@ return Error code
SYErrorCode GetDistanceUserRange(unsigned int nDeviceID, int& nMin, int& nMax);
//Set user ranging range
//@ param [in] nDeviceID Device ID
//@ param [in] nMin Minimum user ranging value
//@ param [in] nMax Maximum user ranging value
//@ return Error code
SYErrorCode SetDistanceUserRange(unsigned int nDeviceID, int nMin, int nMax);
//Read device SN number
//@ param [in] nDeviceID Device ID
//@ param [in/out] nLength Character length
//@ param [in/out] pstrSN Device SN number string pointer, allocate memory externally, pass nullptr to pstrSN to only get nLength
//@ return Error code
SYErrorCode GetDeviceSN(unsigned int nDeviceID, int& nLength, char* pstrSN = nullptr);
//Write device SN number
//@ param [in] nDeviceID Device ID
//@ param [in] nLength Character length
//@ param [in] pstrSN Device SN number string pointer
//@ return Error code
SYErrorCode SetDeviceSN(unsigned int nDeviceID, int nLength, const char* pstrSN);
//Read device firmware version
//@ param [in] nDeviceID Device ID
//@ param [in/out] nLength Character length
//@ param [in/out] pstrHWVersion Firmware version string pointer, allocate memory externally, pass nullptr to pstrHWVersion to only get nLength
//@ return Error code
SYErrorCode GetDeviceHWVersion(unsigned int nDeviceID, int& nLength, char* pstrHWVersion = nullptr);
//Undistort
//@ param [in] nDeviceID Device ID
//@ param [in] pSource Undistorted data pointer
//@ param [in] nWidth Image width
//@ param [in] nHeight Image height
//@ param [in] bDepth Whether it is depth data/RGB data
//@ param [out] pTarget Undistorted result data pointer, allocate memory externally, data length is consistent with the length of undistorted data pointer
SYErrorCode Undistort(unsigned int nDeviceID, const unsigned short* pSource, int nWidth, int nHeight, bool bDepth, unsigned short* pTarget);
Info
Currently , only TOF camera intrinsic parameters can be obtained, RGB camera intrinsic parameters are not supported at present.
//Get camera parameters
//@ param [in] nDeviceID Device ID
//@ param [in] resolution Resolution
//@ param [in/out] intrinsics Camera parameters
SYErrorCode GetIntric(unsigned int nDeviceID, SYResolution resolution, SYIntrinsics& intrinsics);
Info
Supported devices:
CS20-P Firmware version: v4.2.3.0+
CS40 Firmware version: v4.2.3.0+
CS40Pro Firmware version: v4.2.3.0+
Supported after SDKv4.2.3.0
//Change device IP
//@ param [in] nDeviceID Device ID
//@ param [in] nIP Device IP to be written
SYErrorCode ChangeDeviceIP(unsigned int nDeviceID, unsigned int nIP);
//Register error message notification object pointer
//@ param [in] pObserver Error message notification object pointer
//@ return Error code
SYErrorCode RegisterErrorObserver(ISYErrorObserver* pObserver);
//Register event notification object pointer
//@ param [in] pObserver Event notification object pointer
//@ return Error code
SYErrorCode RegisterEventObserver(ISYEventObserver* pObserver);
//Register frame notification object pointer
//@ param [in] pObserver Frame notification object pointer
//@ return Error code
SYErrorCode RegisterFrameObserver(ISYFrameObserver* pObserver);
//Unregister error message notification object pointer
//@ param [in] pObserver Error message notification object pointer
//@ return Error code
SYErrorCode UnRegisterErrorObserver(ISYErrorObserver* pObserver);
//Unregister event notification object pointer
//@ param [in] pObserver Event notification object pointer
//@ return Error code
SYErrorCode UnRegisterEventObserver(ISYEventObserver* pObserver);
//Unregister frame notification object pointer
//@ param [in] pObserver Frame notification object pointer
//@ return Error code
SYErrorCode UnRegisterFrameObserver(ISYFrameObserver* pObserver);