Difference between revisions of "CUVI by Example"
From CUVI Wiki
Line 15: | Line 15: | ||
static const int width = 640; //Width of video frame | static const int width = 640; //Width of video frame | ||
static const int height = 480; //Height of video frame | static const int height = 480; //Height of video frame | ||
//Parameters for feature selection | |||
static const int requestedFeatures = 150; //Number of features to look for | static const int requestedFeatures = 150; //Number of features to look for | ||
static const float featureQuality = 0.006f; //Quality of a feature | static const float featureQuality = 0.006f; //Quality of a feature | ||
static const int featureMinDistance = 3; //Minimum distance between 2 features | static const int featureMinDistance = 3; //Minimum distance between 2 features | ||
static const float k = -2.0f; //k for Harris Corner detector | static const float k = -2.0f; //k for Harris Corner detector | ||
//Parameters for feature tracking | |||
static const int pyramidLevels = 3; //Level Of Scaling | static const int pyramidLevels = 3; //Level Of Scaling | ||
static const CuviSize trackingWindow = cuviSize(30,30); //Size of tracking window | static const CuviSize trackingWindow = cuviSize(30,30); //Size of tracking window | ||
static const float residue = 20.0f; //Absolute Difference Between Original Location Window & Tracked Location Window | static const float residue = 20.0f; //Absolute Difference Between Original Location Window & Tracked Location Window | ||
static const int iterations = 10; //Maximum number of iterations before a feature is found | static const int iterations = 10; //Maximum number of iterations before a feature is found | ||
//Pre-processing parameters | |||
static const bool smoothBeforeSelecting = false; //Smooth Image Before Feature Selection & Tracking | static const bool smoothBeforeSelecting = false; //Smooth Image Before Feature Selection & Tracking | ||
static const bool adjustImage = false; //Adjust Image Light Before Feature Selection | static const bool adjustImage = false; //Adjust Image Light Before Feature Selection | ||
//Post-processing parameters | |||
static const float movementThreshold = 0.33f; //Mark as motion if a feature moves 0.33 Pixels | static const float movementThreshold = 0.33f; //Mark as motion if a feature moves 0.33 Pixels | ||
Line 35: | Line 43: | ||
} | } | ||
// | //Creating a smoothing filter kernel | ||
CuviFilter* Gauss = Cuvi_Builtin_Filters::Gaussian(3,0.7f); //3x3 Gaussian Filter with Standard Deviation 0.7 | CuviFilter* Gauss = Cuvi_Builtin_Filters::Gaussian(3,0.7f); //3x3 Gaussian Filter with Standard Deviation 0.7 | ||
Line 92: | Line 100: | ||
//You can also plot the tracked features on the screen | //You can also plot the tracked features on the screen | ||
} | }while(video_Frames) | ||
//Freeing GPU Memory | //Freeing GPU Memory |
Revision as of 19:14, 30 April 2012
CUVI library comes with all the image processing essentials that can be used to build countless applications. For example the Computer Vision module of CUVI can be used for motion and intrusion detection in a live video stream and tracking an object of interest throughout series of cameras installed in a premises. The processing pipeline for motion detection goes as follows:
- Read a frame from the camera stream
- Select Strong Features in that Frame using CUVI
- Read next frame
- Track features of first frame in the second frame using CUVI
- Set alarm if motion is detected
The CUVI functions used in this example are goodFeaturesToTrack() and trackFeatures(). For simplicity we have removed the I/O part on host side from the code
|