Difference between revisions of "Function:OpticalFlowHS"
From CUVI Wiki
Line 75: | Line 75: | ||
===Sample=== | ===Sample=== | ||
[[File:Flow_hs.jpg]] | [[File:Flow_hs.jpg]] | ||
===Example=== | |||
{| | |||
|style="font-size:150%;"| | |||
<syntaxhighlight lang="cpp"> | |||
//Image size | |||
CuviSize size = cuviSize(img1->width,img1->height); | |||
//Create two 8-bit Grays-scale CuviImage | |||
CuviImage* gimg1 = new CuviImage(size,img1->depth,img1->nChannels); | |||
CuviImage* gimg2 = new CuviImage(size,img1->depth,img1->nChannels); | |||
//Populate the GPU Images | |||
gimg1->upload(img1->imageData,img1->widthStep); | |||
gimg2->upload(img2->imageData,img2->widthStep); | |||
//Create output memory | |||
Cuvi32f *u, *v; | |||
u=(Cuvi32f*)malloc(img0->width*img0->height*sizeof(Cuvi32f)); | |||
v=(Cuvi32f*)malloc(img0->width*img0->height*sizeof(Cuvi32f)); | |||
//Calculates flow of each image pixel in two frames using Horn–Schunck method | |||
cuvi::ComputerVision::opticalFlowHS(gimg1,gimg2,u,v); | |||
</syntaxhighlight> | |||
|} |
Revision as of 15:28, 26 April 2012
Function
|
Parameters
Name | Type | Description |
---|---|---|
previousImage | CuviImage* | The first image whose features are to be tracked |
nextImage | CuviImage* | Second image, in which to look for features of first image |
velocityX | Cuvi32f* | Horizontal velocity vector |
velocityY | Cuvi32f* | Vertical velocity vector |
usePrevious | Cuvi32s | use previous (input) velocity field |
lambda | Cuvi32f | Lagrangian multiplier |
iterations | Cuvi32s | Maximum number of iterations |
stream | CuviStream* | GPU stream ID for execution |
Image Type Support
Input | Output |
---|---|
8uC1 | 32fC1 |
Sample
Error creating thumbnail: Unable to save thumbnail to destination
Example
|