Qualcomm FastCV Library  1.7.1
Motion and object tracking

Functions

FASTCV_API void fcvUpdateMotionHistoryu8s32 (const uint8_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, int32_t *__restrict dst, uint32_t dstStride, int32_t timeStamp, int32_t maxHistory)
 This function calculates the motion history image.
FASTCV_API uint32_t fcvMeanShiftu8 (const uint8_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, fcvRectangleInt *window, fcvTermCriteria criteria)
 Applies the meanshift procedure and obtains the final converged position.
FASTCV_API uint32_t fcvMeanShifts32 (const int32_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, fcvRectangleInt *window, fcvTermCriteria criteria)
 Applies the meanshift procedure and obtains the final converged position.
FASTCV_API uint32_t fcvMeanShiftf32 (const float32_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, fcvRectangleInt *window, fcvTermCriteria criteria)
 Applies the meanshift procedure and obtains the final converged position.
FASTCV_API uint32_t fcvConAdaTracku8 (const uint8_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, fcvRectangleInt *window, fcvTermCriteria criteria, fcvBox2D *circuBox)
 Applies the ConAdaTrack procedure and find the object center, size and orientation.
FASTCV_API uint32_t fcvConAdaTracks32 (const int32_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, fcvRectangleInt *window, fcvTermCriteria criteria, fcvBox2D *circuBox)
 Applies the ConAdaTrack procedure and find the object center, size and orientation.
FASTCV_API uint32_t fcvConAdaTrackf32 (const float32_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, fcvRectangleInt *window, fcvTermCriteria criteria, fcvBox2D *circuBox)
 Applies the ConAdaTrack procedure and find the object center, size and orientation.
FASTCV_API fcvBGCodeWord ** fcvCreateBGCodeBookModel (uint32_t srcWidth, uint32_t srcHeight, void **__restrict cbmodel)
 Creates codebook model according to the image size.
FASTCV_API void fcvReleaseBGCodeBookModel (void **cbmodel)
 Releases codebook model and codebook map.
FASTCV_API void fcvConfigBGCodeBookModel (void *cbmodel, uint8_t cbBound[3], uint8_t minMod[3], uint8_t maxMod[3])
 configure codebook model
FASTCV_API void fcvBGCodeBookUpdateu8 (void *__restrict cbmodel, const uint8_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, const uint8_t *__restrict fgMask, uint32_t fgMaskStride, fcvBGCodeWord **__restrict cbMap, int32_t *__restrict updateTime)
 Updates codebook map according to input image. fgMask can be a reference.
FASTCV_API void fcvBGCodeBookDiffu8 (void *__restrict cbmodel, const uint8_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, uint8_t *__restrict fgMask, uint32_t fgMaskStride, fcvBGCodeWord **__restrict cbMap, int32_t *__restrict numFgMask)
 Generates differential mask of input frame according to background codebook map.
FASTCV_API void fcvBGCodeBookClearStaleu8 (void *__restrict cbmodel, int32_t staleThresh, const uint8_t *__restrict fgMask, uint32_t fgMaskWidth, uint32_t fgMaskHeight, uint32_t fgMaskStride, fcvBGCodeWord **__restrict cbMap)
 Removes stale element in codebook according to foreground mask.

Detailed Description

Supports and tracking functions


Function Documentation

FASTCV_API void fcvBGCodeBookClearStaleu8 ( void *__restrict  cbmodel,
int32_t  staleThresh,
const uint8_t *__restrict  fgMask,
uint32_t  fgMaskWidth,
uint32_t  fgMaskHeight,
uint32_t  fgMaskStride,
fcvBGCodeWord **__restrict  cbMap 
)

Removes stale element in codebook according to foreground mask.

This function removes stale element in codebook according to foreground mask. Threshold is defined in staleThresh. Codebook functions are useful in background subtraction in many use cases, such as video surveillance.

Parameters:
cbmodelPointer to codebook model Codebook model contains parameters for generating and maintaining codebook model
staleThreshThreshold of stale element
fgMaskPointer to the foreground mask image in ROI. Use NULL as default
NOTE: should be 128-bit aligned. must be a 1-channel image.
fgMaskWidthWidth of the mask in pixel, which is the same as input image
NOTE: should be multiple of 8.
fgMaskHeightHeight of the mask in pixel, which is the same as input image
fgMaskStrideStride of the foreground mask image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 fgMaskStride is default to fgMaskWidth.
NOTE: should be multiple of 8.
cbMapPointer to code book map
Codebook map is a pointer map consisting of code word for each pixel of input image.
FASTCV_API void fcvBGCodeBookDiffu8 ( void *__restrict  cbmodel,
const uint8_t *__restrict  src,
uint32_t  srcWidth,
uint32_t  srcHeight,
uint32_t  srcStride,
uint8_t *__restrict  fgMask,
uint32_t  fgMaskStride,
fcvBGCodeWord **__restrict  cbMap,
int32_t *__restrict  numFgMask 
)

Generates differential mask of input frame according to background codebook map.

This function generates differential mask of input frame according to background codebook map. Codebook functions are useful in background subtraction in many use cases, such as video surveillance.

Parameters:
cbmodelPointer to codebook model Codebook model contains parameters for generating and maintaining codebook model
srcPointer to the input image
WARNING: should be 128-bit aligned. must be a 3-channel image.
srcWidthWidth of the image in pixel. The number of pixels in a row.
NOTE: should be multiple of 8.
srcHeightHeight of the image in pixel
srcStrideStride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*3.
NOTE: should be multiple of 8.
fgMaskPointer to the returned foreground mask image.
WARNING: should be 128-bit aligned. must be a 1-channel image, same width & height as src.
fgMaskStrideStride of the foreground mask image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 fgMaskStride is default to srcWidth.
NOTE: should be multiple of 8.
cbMapPointer to code book map.
Codebook map is a pointer map consisting of code word for each pixel of input image.
numFgMaskNumber of foreground pixels in the mask
numFgMask is a return value.
FASTCV_API void fcvBGCodeBookUpdateu8 ( void *__restrict  cbmodel,
const uint8_t *__restrict  src,
uint32_t  srcWidth,
uint32_t  srcHeight,
uint32_t  srcStride,
const uint8_t *__restrict  fgMask,
uint32_t  fgMaskStride,
fcvBGCodeWord **__restrict  cbMap,
int32_t *__restrict  updateTime 
)

Updates codebook map according to input image. fgMask can be a reference.

This function updates codebook map according to input image. fgMask is generated by fcvBGCodeBookDiffu8() and can be a reference in this function. Therefore, fgMask is NULL at the first time. Codebook functions are useful in background subtraction in many use cases, such as video surveillance.

Parameters:
cbmodelPointer to codebook model Codebook model contains parameters for generating and maintaining codebook model
srcPointer to the input image
WARNING: should be 128-bit aligned. must be a 3-channel image.
srcWidthWidth of the image in pixel. The number of pixels in a row.
NOTE: should be multiple of 8.
srcHeightHeight of the image in pixel
srcStrideStride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*3.
NOTE: should be multiple of 8.
fgMaskPointer to the returned foreground mask image. Use NULL as default
WARNING: should be 128-bit aligned. must be a 1-channel image, same width & height as src.
fgMaskStrideStride of the foreground mask image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 fgMaskStride is default to srcWidth.
NOTE: should be multiple of 8.
cbMapPointer to codebook map
Codebook map is a pointer map consisting of code word for each pixel of input image.
updateTimeUpdate time.
updateTime is a return value.
FASTCV_API uint32_t fcvConAdaTrackf32 ( const float32_t *__restrict  src,
uint32_t  srcWidth,
uint32_t  srcHeight,
uint32_t  srcStride,
fcvRectangleInt window,
fcvTermCriteria  criteria,
fcvBox2D circuBox 
)

Applies the ConAdaTrack procedure and find the object center, size and orientation.

This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations.

Parameters:
srcPointer to the original image which is usually a probability image computed based on object histogram. Must be float 32bit grayscale image. Size of buffer is srcStride*srcHeight bytes.
NOTE: should be 128-bit aligned.
srcWidthThe width of the input source image.
NOTE: should be a multiple of 8.
srcHeightThe height of the input source image.
srcStrideStride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4.
NOTE: should be a multiple of 8.
windowPointer to the initial search window position which also returns the final converged window position.
criteriaThe criteria used to finish the object search which consists of two termination criteria: 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations
circuBoxThe circumscribed box around the object
Returns:
Number of iterations
FASTCV_API uint32_t fcvConAdaTracks32 ( const int32_t *__restrict  src,
uint32_t  srcWidth,
uint32_t  srcHeight,
uint32_t  srcStride,
fcvRectangleInt window,
fcvTermCriteria  criteria,
fcvBox2D circuBox 
)

Applies the ConAdaTrack procedure and find the object center, size and orientation.

This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations.

Parameters:
srcPointer to the original image which is usually a probability image computed based on object histogram. Must be int 32bit grayscale image. Size of buffer is srcStride*srcHeight bytes.
NOTE: should be 128-bit aligned.
srcWidthThe width of the input source image.
NOTE: should be a multiple of 8.
srcHeightThe height of the input source image.
srcStrideStride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4.
NOTE: should be a multiple of 8.
windowPointer to the initial search window position which also returns the final converged window position.
criteriaThe criteria used to finish the object search which consists of two termination criteria: 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations
circuBoxThe circumscribed box around the object
Returns:
Number of iterations
FASTCV_API uint32_t fcvConAdaTracku8 ( const uint8_t *__restrict  src,
uint32_t  srcWidth,
uint32_t  srcHeight,
uint32_t  srcStride,
fcvRectangleInt window,
fcvTermCriteria  criteria,
fcvBox2D circuBox 
)

Applies the ConAdaTrack procedure and find the object center, size and orientation.

This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations.

Parameters:
srcPointer to the original image which is usually a probability image computed based on object histogram. Must be 8bit grayscale image. Size of buffer is srcStride*srcHeight bytes.
NOTE: should be 128-bit aligned.
srcWidthThe width of the input source image.
NOTE: should be a multiple of 8.
srcHeightThe height of the input source image.
srcStrideStride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth.
NOTE: should be a multiple of 8.
windowPointer to the initial search window position which also returns the final converged window position.
criteriaThe criteria used to finish the object search which consists of two termination criteria: 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations
circuBoxThe circumscribed box around the object
Returns:
Number of iterations
FASTCV_API void fcvConfigBGCodeBookModel ( void *  cbmodel,
uint8_t  cbBound[3],
uint8_t  minMod[3],
uint8_t  maxMod[3] 
)

configure codebook model

This function configure codebook model. It takes three parameters. They are codebook boundary, minimum and maximum mode for each channel (generally 3). These three parameters are firstly configured in fcvCreateBGCodeBookModel, and the values are (10,10,10), (3,1,1) and (10,1,1) respectively.

Parameters:
cbmodelPointer to codebook model
cbBoundPointer to uint8_t array that should be of 3 elements. This parameter is for updating codebook model in fcvBGCodeBookUpdateu8 that specifies the boundary of each channel.
minModPointer to uint8_t array that should be of 3 elements. This parameter is for generating the mask in fcvBGCodeBookDiffu8 that specifies the minimum mode of each channel of the code word.
maxModPointer to uint8_t array that should be of 3 elements. This parameter is for generating the mask in fcvBGCodeBookDiffu8 that specifies the maximum mode of each channel of the code word.
FASTCV_API fcvBGCodeWord** fcvCreateBGCodeBookModel ( uint32_t  srcWidth,
uint32_t  srcHeight,
void **__restrict  cbmodel 
)

Creates codebook model according to the image size.

This function creates codebook model and returns codebook map. These 2 parameters will be used in fcvBGCodeBookUpdateu8(), fcvBGCodeBookDiffu8() and fcvBGCodeBookClearStaleu8(). Codebook functions are useful in background subtraction in many use cases, such as video surveillance.

Parameters:
srcWidthWidth of the input image.
NOTE: should be multiple of 8. The number of pixels in a row.
srcHeightHeight of the input image.
cbmodelDouble pointer to codebook model. Codebook model contains parameters for generating and maintaining codebook model.
Returns:
Double pointer to codebook map. Codebook map is a pointer map consisting of code word for each pixel of input image.
FASTCV_API uint32_t fcvMeanShiftf32 ( const float32_t *__restrict  src,
uint32_t  srcWidth,
uint32_t  srcHeight,
uint32_t  srcStride,
fcvRectangleInt window,
fcvTermCriteria  criteria 
)

Applies the meanshift procedure and obtains the final converged position.

This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. The converged position search will stop either it has reached the required accuracy or the maximum number of iterations.

Parameters:
srcPointer to the original image which is usually a probability image computed based on object histogram. Must be float 32bit grayscale image. Size of buffer is srcStride*srcHeight bytes.
NOTE: should be 128-bit aligned.
srcWidthThe width of the input source image.
NOTE: should be a multiple of 8.
srcHeightThe height of the input source image.
srcStrideStride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4.
NOTE: should be a multiple of 8.
windowPointer to the initial search window position which also returns the final converged window position.
criteriaThe criteria used to finish the MeanShift which consists of two termination criteria: 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations
Returns:
Number of iterations
FASTCV_API uint32_t fcvMeanShifts32 ( const int32_t *__restrict  src,
uint32_t  srcWidth,
uint32_t  srcHeight,
uint32_t  srcStride,
fcvRectangleInt window,
fcvTermCriteria  criteria 
)

Applies the meanshift procedure and obtains the final converged position.

This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. The converged position search will stop either it has reached the required accuracy or the maximum number of iterations.

Parameters:
srcPointer to the original image which is usually a probability image computed based on object histogram. Must be int 32bit grayscale image. Size of buffer is srcStride*srcHeight bytes.
NOTE: should be 128-bit aligned.
srcWidthThe width of the input source image.
NOTE: should be a multiple of 8.
srcHeightThe height of the input source image.
srcStrideStride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4.
NOTE: should be a multiple of 8.
windowPointer to the initial search window position which also returns the final converged window position.
criteriaThe criteria used to finish the MeanShift which consists of two termination criteria: 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations
Returns:
Number of iterations
FASTCV_API uint32_t fcvMeanShiftu8 ( const uint8_t *__restrict  src,
uint32_t  srcWidth,
uint32_t  srcHeight,
uint32_t  srcStride,
fcvRectangleInt window,
fcvTermCriteria  criteria 
)

Applies the meanshift procedure and obtains the final converged position.

This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. The converged position search will stop either it has reached the required accuracy or the maximum number of iterations.

Parameters:
srcPointer to the original image which is usually a probability image computed based on object histogram. Must be 8 bit grayscale image. Size of buffer is srcStride*srcHeight bytes.
NOTE: should be 128-bit aligned.
srcWidthThe width of the input source image.
NOTE: should be a multiple of 8.
srcHeightThe height of the input source image.
srcStrideStride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth.
NOTE: should be a multiple of 8.
windowPointer to the initial search window position which also returns the final converged window position.
criteriaThe criteria used to finish the MeanShift which consists of two termination criteria: 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations
Returns:
The actually number of iterations
FASTCV_API void fcvReleaseBGCodeBookModel ( void **  cbmodel)

Releases codebook model and codebook map.

This function release codebook model and codebook map. Codebook map is referred in codebook model.

Parameters:
cbmodelDouble pointer to codebook model
FASTCV_API void fcvUpdateMotionHistoryu8s32 ( const uint8_t *__restrict  src,
uint32_t  srcWidth,
uint32_t  srcHeight,
uint32_t  srcStride,
int32_t *__restrict  dst,
uint32_t  dstStride,
int32_t  timeStamp,
int32_t  maxHistory 
)

This function calculates the motion history image.

This function updates the motion history image based on the input motion image. src is a motion image where pixelvalue!=0 indicates a moving pixel. The function go through all the pixels in the src image. If the value is non zero, it sets the corresponding value of the dst image as the timestamp value. If the value is zero, it compares the corresponding value at the dst image with the timestamp value, if the difference is larger than the

Parameters:
srcThe input image/patch. Must be 8 bit grayscale image. Size of buffer is srcStride*srcHeight bytes.
NOTE:should be 128-bit aligned.
srcWidthImage width, the number of pixels in a row
NOTE: should be a multiple of 8.
srcHeightImage height.
srcStrideStride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth.
NOTE: should be a multiple of 8.
dstThe input image/patch. Must be 8 bit grayscale image. Size of buffer is dstStride*srcHeight bytes.
NOTE:should be 128-bit aligned.
dstStrideStride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth.
NOTE: should be a multiple of 8.
timeStampThe timestamp value of the current frame that's being updated.
maxHistoryThe maximum window size that the motion history image will keep.
Returns:
No return value.
 All Data Structures Files Functions Variables Enumerations Enumerator Defines