Defines 2D-based template tracking.
Data Structures | |
| struct | dwTemplateTrackerParameters |
| Configuration parameters for a dwTemplateTrackerIA. More... | |
| struct | dwTemplateArray |
Typedefs | |
| typedef struct dwTemplateTrackerObject * | dwTemplateTrackerHandle_t |
| Handle representing a TemplateTracker tracker. More... | |
| typedef struct dwTemplateTrackerObject const * | dwConstTemplateTrackerHandle_t |
| Handle representing a const TemplateTracker tracker. More... | |
| typedef enum dwTemplateTrackerAlgorithm | dwTemplateTrackerAlgorithm |
| Different versions of the template tracker Both can be found in paper: "Lucas-Kanade 20 Years On: A Unifying Framework" by SIMON BAKER AND IAIN MATTHEWS. More... | |
| typedef struct dwTemplateTrackerParameters | dwTemplateTrackerParameters |
| Configuration parameters for a dwTemplateTrackerIA. More... | |
| typedef struct dwTemplateArray | dwTemplateArray |
Enumerations | |
| enum | dwTemplateTrackerAlgorithm { DW_TEMPLATE_TRACKER_ALGORITHM_IA = 0, DW_TEMPLATE_TRACKER_ALGORITHM_IC } |
| Different versions of the template tracker Both can be found in paper: "Lucas-Kanade 20 Years On: A Unifying Framework" by SIMON BAKER AND IAIN MATTHEWS. More... | |
| typedef struct dwTemplateTrackerObject const* dwConstTemplateTrackerHandle_t |
Handle representing a const TemplateTracker tracker.
Definition at line 97 of file TemplateTracker.h.
| typedef struct dwTemplateArray dwTemplateArray |
| typedef enum dwTemplateTrackerAlgorithm dwTemplateTrackerAlgorithm |
Different versions of the template tracker Both can be found in paper: "Lucas-Kanade 20 Years On: A Unifying Framework" by SIMON BAKER AND IAIN MATTHEWS.
| typedef struct dwTemplateTrackerObject* dwTemplateTrackerHandle_t |
Handle representing a TemplateTracker tracker.
Template tracking is usually applied on video sequence, so the scale between frame N-1 and N should be smooth. maxScaleChange is a parameter to kill significant size changes. Once the ratio of old and new template size is greater than it, the current template entry will be killed.
Pseudo code:if (ZNCC < killThreshold)
tracking is lost, kill the current template
returnif (N-1 to N scaler is not within [1/maxScaleChang, maxScaleChang])
Too significant size change, kill the current template
returnif (ZNCC < updateThreshold)
template image <-- new image
template location <-- new location
template size <-- new size
else
if ((templateCenter - newCenter) > 1px)
template location <-- new location
else
template image <-- new image
template location <-- new location
template size <-- new size
Definition at line 94 of file TemplateTracker.h.
| typedef struct dwTemplateTrackerParameters dwTemplateTrackerParameters |
Configuration parameters for a dwTemplateTrackerIA.
Different versions of the template tracker Both can be found in paper: "Lucas-Kanade 20 Years On: A Unifying Framework" by SIMON BAKER AND IAIN MATTHEWS.
| Enumerator | |
|---|---|
| DW_TEMPLATE_TRACKER_ALGORITHM_IA | inverse additive KLT |
| DW_TEMPLATE_TRACKER_ALGORITHM_IC | inverse compositional KLT. |
Definition at line 102 of file TemplateTracker.h.
| DW_API_PUBLIC dwStatus dwTemplateArray_copyAsync | ( | dwTemplateArray * | dstTemplateArray, |
| const dwTemplateArray * | srcTemplateArray, | ||
| cudaStream_t | stream | ||
| ) |
Deep copy all contents from srcTemplateArray to dstTemplateArray
| [out] | dstTemplateArray | dwTemplateArray to copy to |
| [in] | srcTemplateArray | dwTemplateArray to copy from |
| [in] | stream | Working cuda stream |
dstTemplateArray or srcTemplateArray is NULL. dstTemplateArray.bytes != srcTemplateArray.bytes. | DW_API_PUBLIC dwStatus dwTemplateArray_create | ( | dwTemplateArray * | templateArray, |
| const uint32_t | maxTemplateCount, | ||
| const dwMemoryType | memoryType, | ||
| dwContextHandle_t | context | ||
| ) |
Creates and initializes a template array.
| [out] | templateArray | pointer to the dwTemplateArray is returned here. |
| [in] | maxTemplateCount | maximum number of templates that the template array can have. |
| [in] | memoryType | DW_MEMORY_TYPE_CUDA for CUDA array, DW_MEMORY_TYPE_CPU for CPU array, DW_MEMORY_TYPE_PINNED for pinned memory |
| [in] | context | handle to the context under which it is created. |
| DW_API_PUBLIC dwStatus dwTemplateArray_createNew | ( | dwTemplateArray * | templateArray, |
| const uint32_t | maxTemplateCount, | ||
| const dwMemoryType | memoryType, | ||
| cudaStream_t | stream, | ||
| dwContextHandle_t | context | ||
| ) |
Creates and initializes a template array.
| [out] | templateArray | pointer to the dwTemplateArray is returned here. |
| [in] | maxTemplateCount | maximum number of templates that the template array can have. |
| [in] | memoryType | DW_MEMORY_TYPE_CUDA for CUDA array, DW_MEMORY_TYPE_CPU for CPU array, DW_MEMORY_TYPE_PINNED for pinned memory |
| [in] | stream | Working CUDA stream |
| [in] | context | handle to the context under which it is created. |
| DW_API_PUBLIC dwStatus dwTemplateArray_destroy | ( | dwTemplateArray | templateArray | ) |
Destroys the template array and frees any memory created by dwTemplateArray_createNew().
| [in] | templateArray | template array to be destroyed. |
| DW_API_PUBLIC dwStatus dwTemplateArray_reset | ( | dwTemplateArray * | templateArray, |
| cudaStream_t | stream | ||
| ) |
Resets the template array.
Sets the template count back to zero.
| [in] | templateArray | template array to be reset. |
| [in] | stream | CUDA stream used to reset the template array. |
| DW_API_PUBLIC dwStatus dwTemplateTracker_getCUDAStream | ( | cudaStream_t * | cudaStream, |
| dwTemplateTrackerHandle_t | obj | ||
| ) |
Gets the CUDA stream used.
| [out] | cudaStream | The CUDA stream used. |
| [in] | obj | A pointer to the TemplateTracker handle that is updated. |
| DW_API_PUBLIC dwStatus dwTemplateTracker_initDefaultParams | ( | dwTemplateTrackerParameters * | params | ) |
Initializes TemplateTracker parameters with default values.
| [out] | params | TemplateTracker parameters. |
| DW_API_PUBLIC dwStatus dwTemplateTracker_initialize | ( | dwTemplateTrackerHandle_t * | obj, |
| const dwTemplateTrackerParameters * | params, | ||
| cudaStream_t | stream, | ||
| dwContextHandle_t | context | ||
| ) |
Initialize the TemplateTracker module.
| [out] | obj | A pointer to TemplateTracker handle that is initialized from parameters. |
| [in] | params | TemplateTracker parameters. |
| [in] | stream | Specifies the cuda stream to use |
| [in] | context | Specifies the handle to the context. |
| DW_API_PUBLIC dwStatus dwTemplateTracker_release | ( | dwTemplateTrackerHandle_t | obj | ) |
Releases the TemplateTracker module.
| [in] | obj | The object handle to release. |
| DW_API_PUBLIC dwStatus dwTemplateTracker_reset | ( | dwTemplateTrackerHandle_t | obj | ) |
Resets the TemplateTracker.
| [in] | obj | Handle to reset. |
| DW_API_PUBLIC dwStatus dwTemplateTracker_setCUDAStream | ( | cudaStream_t | cudaStream, |
| dwTemplateTrackerHandle_t | obj | ||
| ) |
Sets the CUDA stream used.
| [in] | cudaStream | The CUDA stream used. |
| [in] | obj | A pointer to the TemplateTracker handle that is updated. |
| DW_API_PUBLIC dwStatus dwTemplateTracker_trackImage | ( | dwTemplateArray * | templateArray, |
| const dwImageCUDA * | currentImage, | ||
| const dwImageCUDA * | previousImage, | ||
| dwTemplateTrackerHandle_t | obj | ||
| ) |
Track the templates in currentImage
.
The computation takes place asynchronously on the device (GPU).
| [in,out] | templateArray | template to be tracked, in-place tracking |
| [in] | currentImage | Current image data to track to. |
| [in] | previousImage | Previous image data to track from. |
| [in] | obj | Specifies the TemplateTracker handle. |
templateArray array contains a list of compacted templates, dwTemplateArray::newToOldMap which maps new->old index: newToOldMap[newIdx] == oldIdx. newToOldMap[i] = j means the i-th template in prediction is the j-th item in input array. i.e. predictedTemplate[i] = oldTemplateToTrack[newToOldMap[i]], below is an example: data: [1 2 3 4 5 6 7 8 9] tracked/untracked: [O O X X O X O X O] compacted output (overwrite 3 and 4 by 9 and 7): data: [1 2 9 7 5] newToOldMap: [0 1 8 6 4] | DW_API_PUBLIC dwStatus dwTemplateTracker_trackPyramid | ( | dwTemplateArray * | templateArray, |
| const dwPyramidImage * | currentPyramid, | ||
| const dwPyramidImage * | previousPyramid, | ||
| dwTemplateTrackerHandle_t | obj | ||
| ) |
Track the templates in currentPyramid
.
The computation takes place asynchronously on the device (GPU).
| [in,out] | templateArray | template to be tracked, in-place tracking |
| [in] | currentPyramid | Current pyramid data to track to. |
| [in] | previousPyramid | Previous pyramid data to track from. |
| [in] | obj | Specifies the TemplateTracker handle. |
templateArray array contains a list of compacted templates, dwTemplateArray::newToOldMap which maps new->old index: newToOldMap[newIdx] == oldIdx. newToOldMap[i] = j means the i-th template in prediction is the j-th item in input array. i.e. predictedTemplate[i] = oldTemplateToTrack[newToOldMap[i]], below is an example: data: [1 2 3 4 5 6 7 8 9] tracked/untracked: [O O X X O X O X O] compacted output (overwrite 3 and 4 by 9 and 7): data: [1 2 9 7 5] newToOldMap: [0 1 8 6 4]