Perception Tool Kit (PTK) API Guide
PTK Streo Algorithm for Obstacle / Freespace detection

Introduction

Data Structures

struct  PTK_Alg_StereoAlgo_configParams
 Stereo algorithm - config Parameters. More...
 
struct  PTK_Alg_StereoAlgo_roadParams
 Stereo algorithm - road Parameters. More...
 
struct  PTK_Alg_StereoAlgo_camParams
 Stereo algorithm - road Parameters. More...
 
struct  PTK_Alg_StereoAlgo_dispParams
 Stereo algorithm - disparity parameters. More...
 
struct  PTK_Alg_StereoAlgo_uvDispParams
 Stereo algorithm - uvDisparity parameters. More...
 
struct  PTK_Alg_StereoAlgo_obsProbParams
 Stereo algorithm - obstacle probability (per pixel) parameters. More...
 
struct  PTK_Alg_StereoAlgo_bottomObsParams
 Stereo algorithm - bottom of obstacle parameter. More...
 
struct  PTK_Alg_StereoAlgo_groundParams
 Stereo algorithm - ground plane parameters. More...
 
struct  PTK_Alg_StereoAlgo_groundModelHistory
 Stereo algorithm - V-disparity ground plane model histroy. More...
 
struct  PTK_Alg_StereoAlgo_groundModelHistory_Array
 Stereo algorithm - V-disparity ground plane model histroy array for muliple models. More...
 
struct  PTK_Alg_StereoAlgo_groundModelParams
 Stereo algorithm - V-disparity ground plane model. More...
 
struct  PTK_Alg_StereoAlgo_groundModelParams_Array
 Stereo algorithm - V-disparity ground plane model array for multiple models. More...
 
struct  PTK_Alg_StereoAlgo_obstacleDetetionMems
 Stereo algorithm - Data mems needed for algorithms. More...
 
struct  PTK_Alg_StereoAlgo_GroundEstimation_allParams
 Stereo algorithm - all required parameters structure for ground plane estimation. More...
 
struct  PTK_Alg_StereoAlgo_GroundEstimationObj
 Stereo algorithm - ground plane estimation context. More...
 
struct  PTK_Alg_StereoAlgo_obsBox
 Stereo algorithm - four corners of a detected obstacle bounding box. More...
 
struct  PTK_Alg_StereoAlgo_driveSpace
 Stereo algorithm - drivable space structure. More...
 
struct  PTK_Alg_StereoAlgo_lineModel
 Stereo algorithm - line model for detected obstacle bounding box. More...
 
struct  PTK_Alg_StereoAlgo_obsDetection
 Stereo algorithm - properties of a detected obstacles. More...
 
struct  PTK_Alg_StereoAlgo_obsDetectionArray
 Stereo algorithm - array of detected obstacels in a frame. More...
 
struct  PTK_Alg_StereoAlgo_closestObsParams
 Stereo algorithm - closest obstacle parameters. More...
 
struct  PTK_Alg_StereoAlgo_detectObsParams
 Stereo algorithm - detected obstacle parameters. More...
 
struct  PTK_Alg_StereoAlgo_mergeObsParams
 Stereo algorithm - obstacle merge parameters. More...
 
struct  PTK_Alg_StereoAlgo_splitObsParams
 Stereo algorithm - obstacle split parameters. More...
 
struct  PTK_Alg_StereoAlgo_ObjectDetect_allParams
 Stereo algorithm - all required parameters structure for obstacle detection. More...
 
struct  PTK_Alg_StereoAlgo_ObjectDetectObj
 Stereo algorithm - obstacle detection algorithm context. More...
 

Functions

int32_t PTK_Alg_StereoAlgo_computeObstacleProbalilityPerPixel (PTK_Alg_StereoAlgo_obsProbParams *copppParams, PTK_Alg_StereoAlgo_camParams *camParams, PTK_Alg_StereoAlgo_groundModelParams_Array *gmParamsArr, PTK_Alg_StereoAlgo_obstacleDetetionMems *algoMemData)
 Compute probabilities of pixels to be obstacle configuration parameters. More...
 
void PTK_Alg_StereoAlgo_computeObstacleProbabilityPerPixel_verticalLoop (PTK_Alg_StereoAlgo_obsProbParams *copppParams, PTK_Alg_StereoAlgo_camParams *camParams, PTK_Alg_StereoAlgo_groundModelParams_Array *gmParamsArr, PTK_Alg_StereoAlgo_obstacleDetetionMems *algoMemData, int32_t horizon)
 Compute probabilities of pixels to be obstacle configuration parameters. More...
 
void PTK_Alg_StereoAlgo_findBottomOfObstacle (PTK_Alg_StereoAlgo_obsProbParams *copppParams, PTK_Alg_StereoAlgo_bottomObsParams *fbooParams, PTK_Alg_StereoAlgo_obstacleDetetionMems *algoMemData)
 Find the closest y positions where obstacles are on every column of an image. More...
 
void PTK_Alg_StereoAlgo_downsampleDisparity (PTK_Alg_StereoAlgo_configParams *config, PTK_Alg_StereoAlgo_obsProbParams *copppParams, int16_t *disparity, float *dsDisparity)
 Downsample input disparity map. More...
 
void PTK_Alg_StereoAlgo_filterLowConfDisparity (int32_t width, int32_t height, int8_t existConf, int8_t threshold, int16_t *disparity, int16_t *outDisparity)
 Filter out low-confidence disparities. More...
 
float PTK_Alg_StereoAlgo_getDisparityFromModel (PTK_Alg_StereoAlgo_groundModelParams *gmParams, float x, float y)
 Get disparity for input position (X, y) from a ground plane model. More...
 
int32_t PTK_Alg_StereoAlgo_findYforDisparity (PTK_Alg_StereoAlgo_groundModelParams *gmParams, PTK_Alg_StereoAlgo_camParams *camParams, int32_t x, float disparity)
 Get y position of a pixel for the given horizontal position and disparity. More...
 
float PTK_Alg_StereoAlgo_disparity2Depth (PTK_Alg_StereoAlgo_camParams *camParams, float disparity, float ypos)
 Convert disparity to depth. More...
 
int32_t PTK_Alg_StereoAlgo_randRange (int32_t min, int32_t max)
 Generate random number between two numbers. More...
 
void PTK_Alg_StereoAlgo_transpose (float *M, int32_t M_width, int32_t M_height, float *Mt)
 Generate random number between two numbers. More...
 
void PTK_Alg_StereoAlgo_multiplyMatrix (float *iM1, int32_t iM1_width, int32_t iM1_height, float *iM2, int32_t iM2_width, int32_t iM2_height, float *oM, int32_t oM_width, int32_t oM_height)
 Multiply two matrices. More...
 
int32_t PTK_Alg_StereoAlgo_LUdecomposition (float *A, int32_t A_width, int32_t A_height, float *b, int32_t b_width, int32_t n_toCompute)
 LU decomposition. More...
 
int32_t PTK_Alg_StereoAlgo_runGroundEstimation (PTK_Alg_StereoAlgo_GroundEstimationObj *cntxt, PTK_Alg_StereoAlgo_groundModelParams_Array *gmParamsArr, uint8_t *inputImageBuffer, int16_t *disparityBuffer, int16_t *outDisparityBuffer)
 Run ground plane model estimation algorithym. More...
 
void PTK_Alg_StereoAlgo_GroundEstimationSetParams (PTK_Alg_StereoAlgo_GroundEstimation_allParams *allPararms, PTK_Alg_StereoAlgo_GroundEstimationObj *cntxt)
 Initialize ground plane estimation parameters. More...
 
int32_t PTK_Alg_StereoAlgo_GroundEstimationConfig (PTK_Alg_StereoAlgo_GroundEstimation_allParams *cfg, PTK_Api_MemoryReq *memReq)
 Computes the memory requirements based on the given algorithm configuration parameters. More...
 
PTK_AlgHandle PTK_Alg_StereoAlgo_GroundEstimationInit (PTK_Alg_StereoAlgo_GroundEstimation_allParams *allParams, const PTK_Api_MemoryRsp *memRsp)
 Initializes the library based on the given algorithm configuration parameters and allocated memory blocks. More...
 
int32_t PTK_Alg_StereoAlgo_GroundEstimationGetMem (PTK_Alg_StereoAlgo_GroundEstimationObj *cntxt, uint8_t *memPtr)
 Get memory size. More...
 
void PTK_Alg_StereoAlgo_GroundEstimationReset (PTK_Alg_StereoAlgo_GroundEstimationObj *cntxt)
 Reset ground plane estimation parameters. More...
 
void PTK_Alg_StereoAlgo_computeVDisparityGroundModel (PTK_Alg_StereoAlgo_GroundEstimationObj *cntxt, PTK_Alg_StereoAlgo_groundModelParams_Array *gmParamsArr)
 Main function to estimat v-disparity based ground plane models. More...
 
void PTK_Alg_StereoAlgo_updateCandidateGPDisparity (PTK_Alg_StereoAlgo_GroundEstimationObj *cntxt, int32_t *numGPDisparity, int32_t *totalNumPixels)
 Get disparities corresponding to ground plane. More...
 
int32_t PTK_Alg_StereoAlgo_modelGroundPlane (PTK_Alg_StereoAlgo_GroundEstimationObj *cntxt, PTK_Alg_StereoAlgo_groundModelParams_Array *gmParamsArr, int32_t *numGPDisparity, int32_t *totalNumPixels)
 Get disparities corresponding to ground plane. More...
 
void PTK_Alg_StereoAlgo_updateGroundPlaneModelHistory (PTK_Alg_StereoAlgo_GroundEstimationObj *cntxt, PTK_Alg_StereoAlgo_groundModelParams_Array *gmParamsArr)
 Update ground model history. More...
 
void PTK_Alg_StereoAlgo_averageGrounPlaneModel (PTK_Alg_StereoAlgo_GroundEstimationObj *cntxt, PTK_Alg_StereoAlgo_groundModelParams_Array *gmParamsArr, int32_t *numGPDisparity)
 Comput the final ground plane model by taking account for previous models. More...
 
void PTK_Alg_StereoAlgo_computePerspectiveForDetection (PTK_Alg_StereoAlgo_ObjectDetectObj *cntxt, PTK_Alg_StereoAlgo_obsDetectionArray *inOda, PTK_Alg_StereoAlgo_obsDetectionArray *outOda)
 Correct perspectives of detected obstacles. More...
 
PTK_Alg_StereoAlgo_lineModel PTK_Alg_StereoAlgo_computeALineModel (PTK_Alg_StereoAlgo_ObjectDetectObj *cntxt, int32_t startInd, int32_t endInd, int8_t dsf, float inlierTh, float adaptiveTerminationPercentage)
 Compute a line model. More...
 
PTK_Alg_StereoAlgo_lineModel PTK_Alg_StereoAlgo_fitModelOneLine (PTK_Alg_StereoAlgo_ObjectDetectObj *cntxt, float *A, float *b, int32_t numData, int8_t computeGram)
 Fit a line to compute a line model. More...
 
int32_t PTK_Alg_StereoAlgo_getInliersOneLine (float *dataBuffer[2], int16_t *inlierIdx, PTK_Alg_StereoAlgo_lineModel model, int32_t numData, float inlierTh)
 Compute the number of inlier after fitting a line. More...
 
void PTK_Alg_StereoAlgo_mergeDetection (PTK_Alg_StereoAlgo_ObjectDetectObj *cntxt, PTK_Alg_StereoAlgo_obsDetectionArray *curOda, PTK_Alg_StereoAlgo_obsDetectionArray *newOda)
 split detected obstacles More...
 
void PTK_Alg_StereoAlgo_splitDetection (PTK_Alg_StereoAlgo_ObjectDetectObj *cntxt, PTK_Alg_StereoAlgo_obsDetectionArray *curOda, PTK_Alg_StereoAlgo_obsDetectionArray *newOda)
 split detected obstacles More...
 
void PTK_Alg_StereoAlgo_removeFarDetection (PTK_Alg_StereoAlgo_ObjectDetectObj *cntxt, PTK_Alg_StereoAlgo_obsDetectionArray *curOda, PTK_Alg_StereoAlgo_obsDetectionArray *newOda)
 Remove too far obstacles. More...
 
PTK_Alg_StereoAlgo_obsDetection PTK_Alg_StereoAlgo_createMergedDetection (PTK_Alg_StereoAlgo_ObjectDetectObj *cntxt, PTK_Alg_StereoAlgo_obsDetectionArray *curOda, int32_t startIdx, int32_t endIdx)
 Merge detected obstacles. More...
 
int32_t PTK_Alg_StereoAlgo_findObstacleFromDisparity (PTK_Alg_StereoAlgo_ObjectDetectObj *cntxt, PTK_Alg_StereoAlgo_obsDetectionArray *oda)
 Main function for obstacle detection. More...
 
void PTK_Alg_StereoAlgo_findClosestDisparity (PTK_Alg_StereoAlgo_ObjectDetectObj *cntxt)
 Find closed dispairty for obstacles. More...
 
void PTK_Alg_StereoAlgo_detectObstacle (PTK_Alg_StereoAlgo_ObjectDetectObj *cntxt, PTK_Alg_StereoAlgo_obsDetectionArray *oda)
 Create final bounding boxes for detected obstacles. More...
 
PTK_Alg_StereoAlgo_lineModel PTK_Alg_StereoAlgo_getlineModel (float offset, float dx)
 Update a line model with offset and dx. More...
 
int32_t PTK_Alg_StereoAlgo_searchFreeDriveDistance (PTK_Alg_StereoAlgo_ObjectDetectObj *cntxt)
 Compute drivable distance in front of a camera. More...
 
void PTK_Alg_StereoAlgo_searchFreeSpace (PTK_Alg_StereoAlgo_ObjectDetectObj *cntxt, int32_t horizon)
 Find free space for every column. More...
 
int32_t PTK_Alg_StereoAlgo_runObjectDetect (PTK_Alg_StereoAlgo_ObjectDetectObj *cntxt, PTK_Alg_StereoAlgo_groundModelParams_Array *gmParamsArr, PTK_Alg_StereoAlgo_obsBox *obsBox, uint32_t *numDetetions, int32_t *freeSpaceBoundary, PTK_Alg_StereoAlgo_driveSpace *drivableSpace, uint8_t *inputImageBuffer, int16_t *disparityBuffer)
 Rund obstacle detection algorithm. More...
 
void PTK_Alg_StereoAlgo_ObjectDetectSetParams (PTK_Alg_StereoAlgo_ObjectDetect_allParams *allPararms, PTK_Alg_StereoAlgo_ObjectDetectObj *cntxt)
 Initialize obstacle detection parameters. More...
 
int32_t PTK_Alg_StereoAlgo_ObjectDetectConfig (PTK_Alg_StereoAlgo_ObjectDetect_allParams *cntxt, PTK_Api_MemoryReq *memReq)
 Computes the memory requirements based on the given algorithm configuration parameters. More...
 
PTK_AlgHandle PTK_Alg_StereoAlgo_ObjectDetectInit (PTK_Alg_StereoAlgo_ObjectDetect_allParams *allParams, const PTK_Api_MemoryRsp *memRsp)
 Initializes the library based on the given algorithm configuration parameters and allocated memory blocks. More...
 
int32_t PTK_Alg_StereoAlgo_ObjectDetectGetMem (PTK_Alg_StereoAlgo_ObjectDetectObj *cntxt, uint8_t *memPtr)
 Get memory size. More...
 

Function Documentation

◆ PTK_Alg_StereoAlgo_computeObstacleProbalilityPerPixel()

int32_t PTK_Alg_StereoAlgo_computeObstacleProbalilityPerPixel ( PTK_Alg_StereoAlgo_obsProbParams copppParams,
PTK_Alg_StereoAlgo_camParams camParams,
PTK_Alg_StereoAlgo_groundModelParams_Array gmParamsArr,
PTK_Alg_StereoAlgo_obstacleDetetionMems algoMemData 
)

Compute probabilities of pixels to be obstacle configuration parameters.

Parameters
[in]copppParamsobstacle probability params
[in]camParamscamera params
[in]gmParamsArrcamera params
[in/out]algoMemData algorihtm data mem

◆ PTK_Alg_StereoAlgo_computeObstacleProbabilityPerPixel_verticalLoop()

void PTK_Alg_StereoAlgo_computeObstacleProbabilityPerPixel_verticalLoop ( PTK_Alg_StereoAlgo_obsProbParams copppParams,
PTK_Alg_StereoAlgo_camParams camParams,
PTK_Alg_StereoAlgo_groundModelParams_Array gmParamsArr,
PTK_Alg_StereoAlgo_obstacleDetetionMems algoMemData,
int32_t  horizon 
)

Compute probabilities of pixels to be obstacle configuration parameters.

Parameters
[in]copppParamsobstacle probability params
[in]camParamscamera params
[in]gmParamsArrcamera params
[in/out]algoMemData algorihtm data mem
[in]horizony position of horizon in an input image

◆ PTK_Alg_StereoAlgo_findBottomOfObstacle()

void PTK_Alg_StereoAlgo_findBottomOfObstacle ( PTK_Alg_StereoAlgo_obsProbParams copppParams,
PTK_Alg_StereoAlgo_bottomObsParams fbooParams,
PTK_Alg_StereoAlgo_obstacleDetetionMems algoMemData 
)

Find the closest y positions where obstacles are on every column of an image.

Parameters
[in]copppParamsobstacle probability params
[in]fbooParamscamera params
[in/out]algoMemData algorihtm data mem

◆ PTK_Alg_StereoAlgo_downsampleDisparity()

void PTK_Alg_StereoAlgo_downsampleDisparity ( PTK_Alg_StereoAlgo_configParams config,
PTK_Alg_StereoAlgo_obsProbParams copppParams,
int16_t *  disparity,
float *  dsDisparity 
)

Downsample input disparity map.

Parameters
[in]configalgorihtm configuration params
[in]copppParamsobstacle probability params
[in]disparityinput disparity map
[out]dsDisparitydownsampled disparity map

◆ PTK_Alg_StereoAlgo_filterLowConfDisparity()

void PTK_Alg_StereoAlgo_filterLowConfDisparity ( int32_t  width,
int32_t  height,
int8_t  existConf,
int8_t  threshold,
int16_t *  disparity,
int16_t *  outDisparity 
)

Filter out low-confidence disparities.

Parameters
[in]widthwidth of depth map
[in]heightheight of depth map
[in]thresholdconfidence threshold
[in]disparityinput disparity map
[in]confidenceconfidence map
[out]outDisparityfiltered disparity map

◆ PTK_Alg_StereoAlgo_getDisparityFromModel()

float PTK_Alg_StereoAlgo_getDisparityFromModel ( PTK_Alg_StereoAlgo_groundModelParams gmParams,
float  x,
float  y 
)

Get disparity for input position (X, y) from a ground plane model.

Parameters
[in]gmParamsground model params
[in]xx position
[in]yy position
Returns
disparity for input position (x, y)

◆ PTK_Alg_StereoAlgo_findYforDisparity()

int32_t PTK_Alg_StereoAlgo_findYforDisparity ( PTK_Alg_StereoAlgo_groundModelParams gmParams,
PTK_Alg_StereoAlgo_camParams camParams,
int32_t  x,
float  disparity 
)

Get y position of a pixel for the given horizontal position and disparity.

Parameters
[in]gmParamsground model params
[in]camParamscamera params
[in]xx position of a pixel
[in]disparitydisparity for a pixel
Returns
Y position of pixel whose horizontal position and disparity value are x and disparity.

◆ PTK_Alg_StereoAlgo_disparity2Depth()

float PTK_Alg_StereoAlgo_disparity2Depth ( PTK_Alg_StereoAlgo_camParams camParams,
float  disparity,
float  ypos 
)

Convert disparity to depth.

Parameters
[in]camParamscamera params
[in]disparitydisparity for a pixel
Returns
depth for an input disparity

◆ PTK_Alg_StereoAlgo_randRange()

int32_t PTK_Alg_StereoAlgo_randRange ( int32_t  min,
int32_t  max 
)

Generate random number between two numbers.

Parameters
[in]minLow limit
[in]maxHigh limit
Returns
random number generated

◆ PTK_Alg_StereoAlgo_transpose()

void PTK_Alg_StereoAlgo_transpose ( float *  M,
int32_t  M_width,
int32_t  M_height,
float *  Mt 
)

Generate random number between two numbers.

Parameters
[in]Minput matrix
[in]M_widthinput matrix width
[in]M_heightinput matrix height
[out]Mttransposed output matrix

◆ PTK_Alg_StereoAlgo_multiplyMatrix()

void PTK_Alg_StereoAlgo_multiplyMatrix ( float *  iM1,
int32_t  iM1_width,
int32_t  iM1_height,
float *  iM2,
int32_t  iM2_width,
int32_t  iM2_height,
float *  oM,
int32_t  oM_width,
int32_t  oM_height 
)

Multiply two matrices.

Parameters
[in]iM1input matrix 1
[in]iM1_widthinput matrix 1 width
[in]iM1_heightinput matrix 1 height
[in]iM2input matrix 2
[in]iM2_widthinput matrix 2 width
[in]iM2_heightinput matrix 2 height
[out]oMoutput matrix
[out]oM_widthoutput matrix width
[out]oM_heightoutput matrix height

◆ PTK_Alg_StereoAlgo_LUdecomposition()

int32_t PTK_Alg_StereoAlgo_LUdecomposition ( float *  A,
int32_t  A_width,
int32_t  A_height,
float *  b,
int32_t  b_width,
int32_t  n_toCompute 
)

LU decomposition.

Parameters
[in]Ainput matrix
[in]A_widthinput matrix width
[in]A_heightinput matrix height
[out]boutput matrix after LU decomposition
[out]b_widthoutput matrix width
[out]n_toComputeoutput matrix height
Returns
permute value for validation

◆ PTK_Alg_StereoAlgo_runGroundEstimation()

int32_t PTK_Alg_StereoAlgo_runGroundEstimation ( PTK_Alg_StereoAlgo_GroundEstimationObj cntxt,
PTK_Alg_StereoAlgo_groundModelParams_Array gmParamsArr,
uint8_t *  inputImageBuffer,
int16_t *  disparityBuffer,
int16_t *  outDisparityBuffer 
)

Run ground plane model estimation algorithym.

Parameters
[in]cntxtalgorithm handle
[in]gmParamsArrground plane model array
[in]inputImageBufferinput (right) image
[in]dispConfidenceBufferdisparity confidence map
[in]disparityBufferdisparity map
[out]outDisparityBufferfiltered disparity map after removing low-confidence disparities
Returns
  • 0, if successful
  • < error code, otherwise

◆ PTK_Alg_StereoAlgo_GroundEstimationSetParams()

void PTK_Alg_StereoAlgo_GroundEstimationSetParams ( PTK_Alg_StereoAlgo_GroundEstimation_allParams allPararms,
PTK_Alg_StereoAlgo_GroundEstimationObj cntxt 
)

Initialize ground plane estimation parameters.

Parameters
[in]allPararmsall configuration parameters for ground plane estimation
[in]cntxtground plane estimation algorithm context
Returns
depth for an input disparity

◆ PTK_Alg_StereoAlgo_GroundEstimationConfig()

int32_t PTK_Alg_StereoAlgo_GroundEstimationConfig ( PTK_Alg_StereoAlgo_GroundEstimation_allParams cfg,
PTK_Api_MemoryReq memReq 
)

Computes the memory requirements based on the given algorithm configuration parameters.

Parameters
[in]cntxtAlgorithm configuration parameters.
[in]memReqMemory requirements as specified below
  • entry [0]: Memory for internal context. Best allocated from the fastest memory.
  • entry [1]: Memory for internal point cloud. Best allocated from the fastest memory.
  • entry [2]: Memory for the output buffer. The output buffer is allocated by the Application so this entry is just to communicate the output buffer size. No need to pass the memory to the library in the init call PTK_Alg_SfmOgmapInit().
Returns
  • PTK_ALG_RET_SUCCESS, if successful
  • < error code, otherwise

◆ PTK_Alg_StereoAlgo_GroundEstimationInit()

PTK_AlgHandle PTK_Alg_StereoAlgo_GroundEstimationInit ( PTK_Alg_StereoAlgo_GroundEstimation_allParams allParams,
const PTK_Api_MemoryRsp memRsp 
)

Initializes the library based on the given algorithm configuration parameters and allocated memory blocks.

Parameters
[in]allParamsAlgorithm configuration parameters.
[in]memRspMemory blocks as specified below
Returns
  • valid handle, if successful
  • NULL, otherwise

◆ PTK_Alg_StereoAlgo_GroundEstimationGetMem()

int32_t PTK_Alg_StereoAlgo_GroundEstimationGetMem ( PTK_Alg_StereoAlgo_GroundEstimationObj cntxt,
uint8_t *  memPtr 
)

Get memory size.

Parameters
[in,out]cntxtAlgorithm handle.
[in]memoryblock pointer

◆ PTK_Alg_StereoAlgo_GroundEstimationReset()

void PTK_Alg_StereoAlgo_GroundEstimationReset ( PTK_Alg_StereoAlgo_GroundEstimationObj cntxt)

Reset ground plane estimation parameters.

Parameters
[in]cntxtAlgorithm handle.

◆ PTK_Alg_StereoAlgo_computeVDisparityGroundModel()

void PTK_Alg_StereoAlgo_computeVDisparityGroundModel ( PTK_Alg_StereoAlgo_GroundEstimationObj cntxt,
PTK_Alg_StereoAlgo_groundModelParams_Array gmParamsArr 
)

Main function to estimat v-disparity based ground plane models.

Parameters
[in]cntxtalgorithm handle
[out]gmParamsArrground plane model array

◆ PTK_Alg_StereoAlgo_updateCandidateGPDisparity()

void PTK_Alg_StereoAlgo_updateCandidateGPDisparity ( PTK_Alg_StereoAlgo_GroundEstimationObj cntxt,
int32_t *  numGPDisparity,
int32_t *  totalNumPixels 
)

Get disparities corresponding to ground plane.

Parameters
[in]cntxtalgorithm handle
[in]numGPDisparitythe number of disparities corresponding to ground
[in]totalNumPixelsthe number of pixels corresponding to ground

◆ PTK_Alg_StereoAlgo_modelGroundPlane()

int32_t PTK_Alg_StereoAlgo_modelGroundPlane ( PTK_Alg_StereoAlgo_GroundEstimationObj cntxt,
PTK_Alg_StereoAlgo_groundModelParams_Array gmParamsArr,
int32_t *  numGPDisparity,
int32_t *  totalNumPixels 
)

Get disparities corresponding to ground plane.

Parameters
[in]cntxtalgorithm handle
[in]gmParamsArrground plane model array
[in]numGPDisparitythe number of disparities corresponding to ground
[in]totalNumPixelsthe number of pixels corresponding to ground
Returns
  • 0, if successful
  • < error code, otherwise

◆ PTK_Alg_StereoAlgo_updateGroundPlaneModelHistory()

void PTK_Alg_StereoAlgo_updateGroundPlaneModelHistory ( PTK_Alg_StereoAlgo_GroundEstimationObj cntxt,
PTK_Alg_StereoAlgo_groundModelParams_Array gmParamsArr 
)

Update ground model history.

Parameters
[in]cntxtalgorithm handle
[in]gmParamsArrground plane model array

◆ PTK_Alg_StereoAlgo_averageGrounPlaneModel()

void PTK_Alg_StereoAlgo_averageGrounPlaneModel ( PTK_Alg_StereoAlgo_GroundEstimationObj cntxt,
PTK_Alg_StereoAlgo_groundModelParams_Array gmParamsArr,
int32_t *  numGPDisparity 
)

Comput the final ground plane model by taking account for previous models.

Parameters
[in]cntxtalgorithm handle
[in]gmParamsArrground plane model array
[in]numGPDisparitythe number of disparities corresponding to ground

◆ PTK_Alg_StereoAlgo_computePerspectiveForDetection()

void PTK_Alg_StereoAlgo_computePerspectiveForDetection ( PTK_Alg_StereoAlgo_ObjectDetectObj cntxt,
PTK_Alg_StereoAlgo_obsDetectionArray inOda,
PTK_Alg_StereoAlgo_obsDetectionArray outOda 
)

Correct perspectives of detected obstacles.

Parameters
[in]cntxtalgorithm handle
[in]inOdadetected obstacle array
[in]outOdadetected obstacle array after correcting perspective
Returns
Merged obstacles

◆ PTK_Alg_StereoAlgo_computeALineModel()

PTK_Alg_StereoAlgo_lineModel PTK_Alg_StereoAlgo_computeALineModel ( PTK_Alg_StereoAlgo_ObjectDetectObj cntxt,
int32_t  startInd,
int32_t  endInd,
int8_t  dsf,
float  inlierTh,
float  adaptiveTerminationPercentage 
)

Compute a line model.

Parameters
[in]cntxtalgorithm handle
[in]startIndfirst horizontal pos of a line
[in]endIndlast horizontal pos of a line
[in]dsfdownsampling factor
[in]inlierThinlier threshold for RANSAC
[in]adaptiveTerminationPercentagedetected obstacle array after correcting perspective
Returns
A line model

◆ PTK_Alg_StereoAlgo_fitModelOneLine()

PTK_Alg_StereoAlgo_lineModel PTK_Alg_StereoAlgo_fitModelOneLine ( PTK_Alg_StereoAlgo_ObjectDetectObj cntxt,
float *  A,
float *  b,
int32_t  numData,
int8_t  computeGram 
)

Fit a line to compute a line model.

Parameters
[in]cntxtalgorithm handle
[in]AA matrix in a linear equation Ax = b
[in]bb vector in a linear equation Ax = b
[in]numDatathe number of data
[in]computeGramflag
Returns
A line model

◆ PTK_Alg_StereoAlgo_getInliersOneLine()

int32_t PTK_Alg_StereoAlgo_getInliersOneLine ( float *  dataBuffer[2],
int16_t *  inlierIdx,
PTK_Alg_StereoAlgo_lineModel  model,
int32_t  numData,
float  inlierTh 
)

Compute the number of inlier after fitting a line.

Parameters
[in]dataBufferdata used to fit a line
[in]inlierIdxinlier data index
[in]modelline model
[in]numDatanumber of data
[in]inlierThinlier threshold
Returns
the number of inlier

◆ PTK_Alg_StereoAlgo_mergeDetection()

void PTK_Alg_StereoAlgo_mergeDetection ( PTK_Alg_StereoAlgo_ObjectDetectObj cntxt,
PTK_Alg_StereoAlgo_obsDetectionArray curOda,
PTK_Alg_StereoAlgo_obsDetectionArray newOda 
)

split detected obstacles

Parameters
[in]cntxtalgorithm handle
[in]curOdadetected obstacle array
[in]newOdadetected obstacle array after merging obstacles

◆ PTK_Alg_StereoAlgo_splitDetection()

void PTK_Alg_StereoAlgo_splitDetection ( PTK_Alg_StereoAlgo_ObjectDetectObj cntxt,
PTK_Alg_StereoAlgo_obsDetectionArray curOda,
PTK_Alg_StereoAlgo_obsDetectionArray newOda 
)

split detected obstacles

Parameters
[in]cntxtalgorithm handle
[in]curOdadetected obstacle array
[in]newOdadetected obstacle array after spliting obstacles

◆ PTK_Alg_StereoAlgo_removeFarDetection()

void PTK_Alg_StereoAlgo_removeFarDetection ( PTK_Alg_StereoAlgo_ObjectDetectObj cntxt,
PTK_Alg_StereoAlgo_obsDetectionArray curOda,
PTK_Alg_StereoAlgo_obsDetectionArray newOda 
)

Remove too far obstacles.

Parameters
[in]cntxtalgorithm handle
[in]curOdadetected obstacle array
[in]newOdadetected obstacle array after removing far obstacles

◆ PTK_Alg_StereoAlgo_createMergedDetection()

PTK_Alg_StereoAlgo_obsDetection PTK_Alg_StereoAlgo_createMergedDetection ( PTK_Alg_StereoAlgo_ObjectDetectObj cntxt,
PTK_Alg_StereoAlgo_obsDetectionArray curOda,
int32_t  startIdx,
int32_t  endIdx 
)

Merge detected obstacles.

Parameters
[in]cntxtalgorithm handle
[in]curOdadetected obstacle array
[in]startIdxindex of the first obstacle to merge
[in]endIdxindex of the last obstacle to merge
Returns
Merged obstacles

◆ PTK_Alg_StereoAlgo_findObstacleFromDisparity()

int32_t PTK_Alg_StereoAlgo_findObstacleFromDisparity ( PTK_Alg_StereoAlgo_ObjectDetectObj cntxt,
PTK_Alg_StereoAlgo_obsDetectionArray oda 
)

Main function for obstacle detection.

Parameters
[in]cntxtalgorithm handle
[out]odaarray of detected obstacels

◆ PTK_Alg_StereoAlgo_findClosestDisparity()

void PTK_Alg_StereoAlgo_findClosestDisparity ( PTK_Alg_StereoAlgo_ObjectDetectObj cntxt)

Find closed dispairty for obstacles.

Parameters
[in]cntxtalgorithm handle

◆ PTK_Alg_StereoAlgo_detectObstacle()

void PTK_Alg_StereoAlgo_detectObstacle ( PTK_Alg_StereoAlgo_ObjectDetectObj cntxt,
PTK_Alg_StereoAlgo_obsDetectionArray oda 
)

Create final bounding boxes for detected obstacles.

Parameters
[in]cntxtalgorithm handle
[out]odaarray of detected obstacels

◆ PTK_Alg_StereoAlgo_getlineModel()

PTK_Alg_StereoAlgo_lineModel PTK_Alg_StereoAlgo_getlineModel ( float  offset,
float  dx 
)

Update a line model with offset and dx.

Parameters
[in]offsetslope of V-disparity ground model
[in]dxoffset of V-disparity ground model
Returns
line model

◆ PTK_Alg_StereoAlgo_searchFreeDriveDistance()

int32_t PTK_Alg_StereoAlgo_searchFreeDriveDistance ( PTK_Alg_StereoAlgo_ObjectDetectObj cntxt)

Compute drivable distance in front of a camera.

Parameters
[in]cntxtalgorithm handle
Returns
drivable distance in front of a camera

◆ PTK_Alg_StereoAlgo_searchFreeSpace()

void PTK_Alg_StereoAlgo_searchFreeSpace ( PTK_Alg_StereoAlgo_ObjectDetectObj cntxt,
int32_t  horizon 
)

Find free space for every column.

Parameters
[in]cntxtalgorithm handle

◆ PTK_Alg_StereoAlgo_runObjectDetect()

int32_t PTK_Alg_StereoAlgo_runObjectDetect ( PTK_Alg_StereoAlgo_ObjectDetectObj cntxt,
PTK_Alg_StereoAlgo_groundModelParams_Array gmParamsArr,
PTK_Alg_StereoAlgo_obsBox obsBox,
uint32_t *  numDetetions,
int32_t *  freeSpaceBoundary,
PTK_Alg_StereoAlgo_driveSpace drivableSpace,
uint8_t *  inputImageBuffer,
int16_t *  disparityBuffer 
)

Rund obstacle detection algorithm.

Parameters
[in]cntxtalgorithm handle
[in]gmParamsArrground plane model array
[out]obsBoxobstacle bounding boxes
[out]numDetetionsthe number of detected obstacles
[in]inputImageBufferinput (right) image
[in]disparityBufferinput disparity map
Returns
  • 0, if successful
  • < error code, otherwise

◆ PTK_Alg_StereoAlgo_ObjectDetectSetParams()

void PTK_Alg_StereoAlgo_ObjectDetectSetParams ( PTK_Alg_StereoAlgo_ObjectDetect_allParams allPararms,
PTK_Alg_StereoAlgo_ObjectDetectObj cntxt 
)

Initialize obstacle detection parameters.

Parameters
[in]allPararmsall configuration parameters for obstacle detection
[in]cntxtobstacle detection algorithm context
Returns
depth for an input disparity

◆ PTK_Alg_StereoAlgo_ObjectDetectConfig()

int32_t PTK_Alg_StereoAlgo_ObjectDetectConfig ( PTK_Alg_StereoAlgo_ObjectDetect_allParams cntxt,
PTK_Api_MemoryReq memReq 
)

Computes the memory requirements based on the given algorithm configuration parameters.

Parameters
[in]cntxtAlgorithm configuration parameters.
[in]memReqMemory requirements as specified below
  • entry [0]: Memory for internal context. Best allocated from the fastest memory.
  • entry [1]: Memory for internal point cloud. Best allocated from the fastest memory.
  • entry [2]: Memory for the output buffer. The output buffer is allocated by the Application so this entry is just to communicate the output buffer size. No need to pass the memory to the library in the init call PTK_Alg_SfmOgmapInit().
Returns
  • PTK_ALG_RET_SUCCESS, if successful
  • < error code, otherwise

◆ PTK_Alg_StereoAlgo_ObjectDetectInit()

PTK_AlgHandle PTK_Alg_StereoAlgo_ObjectDetectInit ( PTK_Alg_StereoAlgo_ObjectDetect_allParams allParams,
const PTK_Api_MemoryRsp memRsp 
)

Initializes the library based on the given algorithm configuration parameters and allocated memory blocks.

Parameters
[in]allParamsAlgorithm configuration parameters.
[in]memRspMemory blocks as specified below
Returns
  • valid handle, if successful
  • NULL, otherwise

◆ PTK_Alg_StereoAlgo_ObjectDetectGetMem()

int32_t PTK_Alg_StereoAlgo_ObjectDetectGetMem ( PTK_Alg_StereoAlgo_ObjectDetectObj cntxt,
uint8_t *  memPtr 
)

Get memory size.

Parameters
[in,out]cntxtAlgorithm handle.
[in]memoryblock pointer