Difference between revisions of "Function:GoodFeaturesToTrack"

From CUVI Wiki
Line 70: Line 70:
//Populate the Image
//Populate the Image
gpu_image->upload(img->imageData,img->widthStep);
gpu_image->upload(img->imageData,img->widthStep);


CuviPointValue2D *features;
CuviPointValue2D *features;


// Desired number of features
//Desired number of features
int featureCount = 100;
int featureCount = 100;


Line 80: Line 79:
CuviROI roi = cuviROI(0,0,img->width,img->height);
CuviROI roi = cuviROI(0,0,img->width,img->height);


// Setting Feature selection parameters
//Setting Feature selection parameters
CuviFeaturesCriteria criteria = cuviFeaturesCriteria(CUVI_FEATURES_HARRIS_PETER,0.006f,15,3,-2.0f);
CuviFeaturesCriteria criteria = cuviFeaturesCriteria(CUVI_FEATURES_HARRIS_PETER,0.006f,15,3,-2.0f);


//calling GoodFeaturesToTrack
//Calling GoodFeaturesToTrack
cuvi::computerVision::goodFeaturesToTrack(&gimg,roi,&features,&featureCount,criteria);
cuvi::computerVision::goodFeaturesToTrack(&gimg,roi,&features,&featureCount,criteria);


</syntaxhighlight>
</syntaxhighlight>
|}
|}

Revision as of 20:21, 25 April 2012

Detecting interesting parts of an image is an important step in most computer vision applications. Itserves as the first low-level processing step in applications like image segmentation, object recognition, object tracking and motion estimation. CUVI offers feature detectors including KLT, Harris and Peter in a single function

Function

CuviStatus goodFeaturesToTrack(CuviImage* srcImage
                               CuviROI roi,
                               CuviPointValue2D** outputFeatures,
                               Cuvi32s* maxFeatures,
                               CuviFeaturesCriteria criteria,
                               CuviStream* stream = NULL);

Parameters

Name Type Description
srcImage CuviImage* Input 8 bit Gray Scale Image.
roi CuviROI Desired region of interest of input image. The function will return features from only that region of the image
outputFeatures CuviPointValue2D** Output feature list that contains the coordinates & values of features/corners.
maxFeatures Cuvi32s* Desired number of features. If the total features detected in the image or ROI are less than maxFeatures its value is updated to that number
criteria CuviFeaturesCriteria A structure containing various parameters that affect feature selection behavior
stream CuviStream* GPU stream ID for execution


Image Type Support

Input Output
8uC1 CuviPointValue2D


Example

//Create an 8-bit Grays-scale CuviImage
CuviImage *gpu_image = new CuviImage(size,img->depth,img->nChannels);

//Populate the Image
gpu_image->upload(img->imageData,img->widthStep);

CuviPointValue2D *features;

//Desired number of features
int featureCount = 100;

//Selecting complete image for the process
CuviROI roi = cuviROI(0,0,img->width,img->height);

//Setting Feature selection parameters
CuviFeaturesCriteria criteria = cuviFeaturesCriteria(CUVI_FEATURES_HARRIS_PETER,0.006f,15,3,-2.0f);

//Calling GoodFeaturesToTrack
cuvi::computerVision::goodFeaturesToTrack(&gimg,roi,&features,&featureCount,criteria);