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 | ||
CuviFilter* f; // Declaring CUVI Filter | |||
//Parameters for feature selection | //Parameters for feature selection | ||
Line 44: | Line 45: | ||
} | } | ||
void main() | void main() | ||
{ | { | ||
//Creating a smoothing 3x3 Gaussian Filter with Standard Deviation 0.7 | |||
cuviCreateFilter(&f,3,3); | |||
f->sigma = 0.7f; | |||
cuviCreateFilterSpecial(f,CUVI_FILTER_GAUSSIAN); | |||
//Buffer Images on GPU | //Buffer Images on GPU | ||
CuviImage* gFrame = new CuviImage(width,height,pitch,8,3); | CuviImage* gFrame = new CuviImage(width,height,pitch,8,3); | ||
Line 88: | Line 92: | ||
if(SmoothBeforeSelecting){ | if(SmoothBeforeSelecting){ | ||
//Apply Gaussian Smoothing Filter On Both The Images | //Apply Gaussian Smoothing Filter On Both The Images | ||
cuvi::imageFiltering::imageFilter(gimg1,roi, | cuvi::imageFiltering::imageFilter(gimg1,roi,f); | ||
cuvi::imageFiltering::imageFilter(gimg2,roi, | cuvi::imageFiltering::imageFilter(gimg2,roi,f); | ||
} | } | ||
Revision as of 21:39, 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
|
Here's an exact same example applied on a video feed of a webcam