Difference between revisions of "Function:OpticalFlowHS"
From CUVI Wiki
Line 4: | Line 4: | ||
|style="font-size:150%;"| | |style="font-size:150%;"| | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
CuviStatus opticalFlowHS(CuviImage | CuviStatus opticalFlowHS(const CuviImage& previous, | ||
CuviImage | const CuviImage& next, | ||
Cuvi32f* | Cuvi32f* flowX, | ||
Cuvi32f* | Cuvi32f* flowY, | ||
const bool usePrevious = 0, | |||
Cuvi32f lambda = 1.0f , | const Cuvi32f lambda = 1.0f , | ||
Cuvi32s iterations = 1, | const Cuvi32s iterations = 1, | ||
CuviStream | const CuviStream& stream = CuviStream()); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} | ||
Line 25: | Line 25: | ||
! Description | ! Description | ||
|- | |- | ||
| | | previous | ||
| CuviImage | | const CuviImage& | ||
| The first image whose features are to be tracked | | The first image whose features are to be tracked | ||
|- | |- | ||
| | | next | ||
| CuviImage | | const CuviImage& | ||
| Second image, in which to look for features of first image | | Second image, in which to look for features of first image | ||
|- | |- | ||
| | | flowX | ||
| Cuvi32f* | | Cuvi32f* | ||
| Horizontal velocity vector | | Horizontal velocity vector | ||
|- | |- | ||
| | | flowY | ||
| Cuvi32f* | | Cuvi32f* | ||
| Vertical velocity vector | | Vertical velocity vector | ||
|- | |- | ||
| usePrevious | | usePrevious | ||
| | | bool | ||
| use previous (input) velocity field | | use previous (input) velocity field | ||
|- | |- | ||
| lambda | | lambda | ||
| Cuvi32f | | const Cuvi32f | ||
| Lagrangian multiplier | | Lagrangian multiplier | ||
|- | |- | ||
| iterations | | iterations | ||
| Cuvi32s | | const Cuvi32s | ||
| Maximum number of iterations | | Maximum number of iterations | ||
|- | |- | ||
Line 84: | Line 84: | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
//Create two 8-bit Grays-scale CuviImage | //Create two 8-bit Grays-scale CuviImage | ||
CuviImage | CuviImage gimg1 = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_GRAYSCALE); | ||
CuviImage | CuviImage gimg2 = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_GRAYSCALE); | ||
//Create output memory | //Create output memory | ||
Cuvi32f * | Cuvi32f* u = new Cuvi32f[gimg.width() * gimg.height()]; | ||
u=( | Cuvi32f* v = new Cuvi32f[gimg.width() * gimg.height()]; | ||
v=( | |||
//Calculates flow of each image pixel in two frames using Horn–Schunck method | //Calculates flow of each image pixel in two frames using Horn–Schunck method | ||
cuvi:: | cuvi::computerVision::opticalFlowHS(gimg1,gimg2,u,v); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} |
Revision as of 15:39, 19 April 2013
Function
|
Parameters
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 |
flowX | Cuvi32f* | Horizontal velocity vector |
flowY | Cuvi32f* | Vertical velocity vector |
usePrevious | bool | use previous (input) velocity field |
lambda | const Cuvi32f | Lagrangian multiplier |
iterations | const 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
|