Difference between revisions of "Function:OpticalFlowHS"
From CUVI Wiki
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
===Function=== | ====Function==== | ||
{| | {| | ||
|style="font-size: | |style="font-size:100%;"| | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="C"> | ||
CuviStatus opticalFlowHS(CuviImage | CuviStatus opticalFlowHS(const CuviImage& previous, | ||
CuviImage | const CuviImage& next, | ||
Cuvi32f* | Cuvi32f* flowX, | ||
Cuvi32f* | Cuvi32f* flowY, | ||
const bool usePrevious, | |||
Cuvi32f lambda = 1.0f , | const Cuvi32f lambda = 1.0f , | ||
Cuvi32s iterations = 1, | const Cuvi32s iterations = 1, | ||
CuviStream | const CuviStream& stream = CuviStream()); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} | ||
====Parameters==== | |||
{| | |||
|style="font-size:75%;"| | |||
===Parameters=== | |||
{|class="wikitable" | {|class="wikitable" | ||
|- | |- | ||
Line 25: | Line 24: | ||
! 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 56: | Line 55: | ||
| CuviStream* | | CuviStream* | ||
| GPU stream ID for execution | | GPU stream ID for execution | ||
|} | |||
|} | |} | ||
====Image Type Support==== | |||
===Image Type Support=== | {| | ||
|style="font-size:75%;"| | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 69: | Line 68: | ||
| 8uC1 | | 8uC1 | ||
| 32fC1 | | 32fC1 | ||
|} | |||
|} | |} | ||
====Sample==== | |||
[[File:Flow_hs.jpg]] | |||
====Example==== | |||
{| | |||
|style="font-size:100%;"| | |||
<syntaxhighlight lang="cpp"> | |||
//Create two 8-bit Grays-scale CuviImage | |||
CuviImage gimg1 = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_GRAYSCALE); | |||
CuviImage gimg2 = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_GRAYSCALE); | |||
//Create output memory | |||
Cuvi32f* u = new Cuvi32f[gimg.width() * gimg.height()]; | |||
Cuvi32f* v = new Cuvi32f[gimg.width() * gimg.height()]; | |||
//Calculates flow of each image pixel in two frames using Horn–Schunck method | |||
cuvi::computerVision::opticalFlowHS(gimg1,gimg2,u,v,false); | |||
</syntaxhighlight> | |||
|} |
Latest revision as of 22:15, 18 October 2022
Function
|
Parameters
|
Image Type Support
|
Sample
Error creating thumbnail: Unable to save thumbnail to destination
Example
|