From CUVI Wiki
Jump to: navigation, search

CUVI Feature tracker tracks input features from frame 1 onto frame 2. The function is ideal for tracking selected number of features through an image sequence or a video stream. This is a custom algorithm and does not use optical flows to estimate motion. Check out Motion Estimate section for more details on Optical Flow based motion tracking.


CuviStatus trackFeatures(const CuviImage& previous,
                         const CuviImage& next,
                         CuviPointValue2D<Cuvi32f,Cuvi32f>* inputFeatures,
                         CuviPointValue2D<Cuvi32f,Cuvi32f>*& trackedFeatures,
                         const Cuvi32s featureCount,
                         CuviTrackingCriteria criteria,
                         const CuviStream& stream = CuviStream());


Name Type Description
previous const CuviImage& The first image whose features are to be tracked
next const CuviImage& Second image, in which to look for features of first image
inputFeatures CuviPointValue2D<Cuvi32f,Cuvi32f>* Feature of first image
trackedFeatures CuviPointValue2D<Cuvi32f,Cuvi32f>*& Output feature list containing the location of tracked features from first image onto second image
featureCount const Cuvi32s Number of features to track
criteria CuviFeaturesCriteria A structure containing various parameters that affect feature tracking behavior
stream const CuviStream& GPU stream ID for execution

Image Type Support

Input Output
8uC1 CuviPointValue2D




//Image size
CuviSize size = cuviSize(img1->width,img1->height);
//Create two 8-bit Grays-scale CuviImage objects
CuviImage gimg1 = cuvi::io::loadImage(path, CUVI_LOAD_IMAGE_GRAYSCALE);
CuviImage gimg2 = cuvi::io::loadImage(path, CUVI_LOAD_IMAGE_GRAYSCALE);
CuviPointValue2D* features1, *features2;
//selection and tracking criteria
CuviFeaturesCriteria fc(CUVI_FEATURES_HARRIS,0.006f,22);
CuviTrackingCriteria tc(2,CuviSize(12,12),15,10.0f);
//ROI for selection
CuviRect roi(0,0,gimg1.width(),gimg1.height());
int featureCount = 50;
//Select Features
//Track the selected features from first frame onto second frame