Difference between revisions of "Function:OpticalFlowPyrLKDense"
From CUVI Wiki
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
Computes Dense Optical Flow between each pixel of two images using pyramidal Lucas-Kanade method. | Computes Dense Optical Flow between each pixel of two images using pyramidal Lucas-Kanade method. | ||
===Function=== | ====Function==== | ||
{| | {| | ||
|style="font-size: | |style="font-size:100%;"| | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
CuviStatus opticalFlowPyrLKDense(CuviImage | CuviStatus opticalFlowPyrLKDense(const CuviImage& previous, | ||
CuviImage | const CuviImage& next, | ||
Cuvi32f* flowX | Cuvi32f* flowX | ||
Cuvi32f* flowY, | Cuvi32f* flowY, | ||
CuviTrackingCriteria criteria, | const CuviTrackingCriteria criteria, | ||
CuviStream | const CuviStream& stream = CuviStream()); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} | ||
===Parameters=== | ===Parameters=== | ||
{| | |||
|style="font-size:75%;"| | |||
{|class="wikitable" | {|class="wikitable" | ||
|- | |- | ||
Line 21: | Line 23: | ||
! Description | ! Description | ||
|- | |- | ||
| | | previous | ||
| CuviImage | | CuviImage& | ||
| The first image whose features are to be tracked | | The first image whose features are to be tracked | ||
|- | |- | ||
| | | next | ||
| CuviImage | | CuviImage& | ||
| Second image, in which to look for features of first image | | Second image, in which to look for features of first image | ||
|- | |- | ||
Line 38: | Line 40: | ||
|- | |- | ||
| criteria | | criteria | ||
| CuviFeaturesCriteria | | const CuviFeaturesCriteria | ||
| A structure containing various parameters that affect optical flow calculation | | A structure containing various parameters that affect optical flow calculation | ||
|- | |- | ||
| stream | | stream | ||
| CuviStream | | const 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 58: | Line 60: | ||
| 2x Cuvi32f* | | 2x Cuvi32f* | ||
|} | |} | ||
|} | |} | ||
====Samples==== | |||
[[File:OF_frame1.png|none|frame|First Input Image (8-bit)]] | |||
<br/> | |||
[[File:OF_frame2.png|none|frame|Second Input Image (8-bit)]] | |||
<br/> | |||
[[File:OF_flowMag.png|none|frame| Optical Flow Magnitude]] | |||
<br/> | |||
[[File:OF_sparseFlow.png|none|frame| Flow of selected points]] | |||
<br/> | |||
====Code Example==== | |||
===Example=== | |||
{| | {| | ||
|style="font-size: | |style="font-size:100%;"| | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
//Create two 8-bit Grays-scale CuviImage objects | //Create two 8-bit Grays-scale CuviImage objects | ||
CuviImage | CuviImage gimg1 = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_GRAYSCALE); | ||
CuviImage | CuviImage gimg2 = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_GRAYSCALE); | ||
Cuvi32f* flowX = new Cuvi32f[width * height]; | Cuvi32f* flowX = new Cuvi32f[gimg1.width() * gimg1.height()]; | ||
Cuvi32f* flowY = new Cuvi32f[width * height]; | Cuvi32f* flowY = new Cuvi32f[gimg1.width() * gimg1.height()]; | ||
//tracking criteria | //tracking criteria | ||
CuviTrackingCriteria tc | CuviTrackingCriteria tc; | ||
//Compute optical flow between first frame and second frame | //Compute optical flow between first frame and second frame |
Latest revision as of 22:18, 18 October 2022
Computes Dense Optical Flow between each pixel of two images using pyramidal Lucas-Kanade method.
Function
|
Parameters
|
Image Type Support
|
Samples
Error creating thumbnail: Unable to save thumbnail to destination
Error creating thumbnail: Unable to save thumbnail to destination
Error creating thumbnail: Unable to save thumbnail to destination
Error creating thumbnail: Unable to save thumbnail to destination
Code Example
|