This tutorial shows how dwFeature2DDetector and dwFeature2DTracker modules are typically used. Note that error handling is left out for clarity.
Modify parameters according to input image and detection requirements, create detector. Detector will first split the given WxH input image into cellSize x cellSize cells, detect Harris corner whose score is higher than scoreThreshold. Features with score >= scoreThreshold will be considered as high frequency details (red crosses). Detail features will be added to candidate list first, detector will then sort the rest features with score between (scoreThreshold, detailThreshold) from highest to lowest by cell, select the first numEvenDistributionPerCell features in each cell (blue crosses, here numEvenDistributionPerCell = 5, so there're 5 second-highest-score features in each cell). These second-highest-score features are distributed evenly across cells.
Setting scoreThreshold >= detailThreshold means all features are high frequency details, numEvenDistributionPerCell will be invalid. Setting numEvenDistributionPerCell = 0 turns off the even distribution component. Both of the 2 cases will make detected features be clustered in high frequency regions, i.e. only red crosses will be left in above illustration. contextHandle
is assumed to be previously initialized dwContextHandle_t.
Modify parameters according to input image and tracking requirements, create tracker. trackerConfig.isInputCompact
must be read from detector. contextHandle
is assumed to be previously initialized dwContextHandle_t.
Create 2 image pyramids as detection/tracking input: one is current, one is previous, the 2 pyramids work as a double buffer (or ping-pong buffer). They swap each other after each detection/tracking cycle. So new frame will always be read into pyrmaidCurrent and the previous frame will be stored to pyramidPrevious.
dwPyramid_create
only creates pyramid image and allocates memory, pyramid will be filled in dwImageFilter_computePyramid
. Top level (level 0) in pyramid is always the same size as original input image.
inputImageProps.width
, inputImageProps.height
are the same in tracker/detector initialization
imagePxlType
should be got from dwImage_getPixelType(inputImageProps.format)
.
contextHandle
is assumed to be previously initialized dwContextHandle_t.
#### Create nccScore array on GPU
For the full implementation refer to Feature Tracker Sample.