<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.cuvilib.com/index.php?action=history&amp;feed=atom&amp;title=Function%3AOpticalFlowPyrLK</id>
	<title>Function:OpticalFlowPyrLK - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.cuvilib.com/index.php?action=history&amp;feed=atom&amp;title=Function%3AOpticalFlowPyrLK"/>
	<link rel="alternate" type="text/html" href="https://wiki.cuvilib.com/index.php?title=Function:OpticalFlowPyrLK&amp;action=history"/>
	<updated>2026-08-17T09:48:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://wiki.cuvilib.com/index.php?title=Function:OpticalFlowPyrLK&amp;diff=578&amp;oldid=prev</id>
		<title>Ghazanfar: Created page with &quot;__NOTOC__ Computes Dense Optical Flow between each pixel of two images using pyramidal Lucas-Kanade method. ===Function=== {| |style=&quot;font-size:150%;&quot;| &lt;syntaxhighlight lang=&quot;...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.cuvilib.com/index.php?title=Function:OpticalFlowPyrLK&amp;diff=578&amp;oldid=prev"/>
		<updated>2012-05-14T07:12:26Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__NOTOC__ Computes Dense Optical Flow between each pixel of two images using pyramidal Lucas-Kanade method. ===Function=== {| |style=&amp;quot;font-size:150%;&amp;quot;| &amp;lt;syntaxhighlight lang=&amp;quot;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
Computes Dense Optical Flow between each pixel of two images using pyramidal Lucas-Kanade method.&lt;br /&gt;
===Function===&lt;br /&gt;
{|&lt;br /&gt;
|style=&amp;quot;font-size:150%;&amp;quot;|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CuviStatus opticalFlowPyrLKDense(CuviImage* previousImage,&lt;br /&gt;
                                 CuviImage* nextImage,&lt;br /&gt;
                                 Cuvi32f* flowX&lt;br /&gt;
                                 Cuvi32f* flowY,&lt;br /&gt;
                                 CuviTrackingCriteria criteria,&lt;br /&gt;
                                 CuviStream* stream = NULL);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Parameters===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name	&lt;br /&gt;
! Type	&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| previousImage&lt;br /&gt;
| CuviImage*&lt;br /&gt;
| The first image whose features are to be tracked&lt;br /&gt;
|-&lt;br /&gt;
| nextImage&lt;br /&gt;
| CuviImage*&lt;br /&gt;
| Second image, in which to look for features of first image&lt;br /&gt;
|-&lt;br /&gt;
| flowX&lt;br /&gt;
| Cuvi32f*&lt;br /&gt;
| Horizontal optical flow&lt;br /&gt;
|-&lt;br /&gt;
| flowY&lt;br /&gt;
| Cuvi32f*&lt;br /&gt;
| Vertical optical flow&lt;br /&gt;
|-&lt;br /&gt;
| criteria&lt;br /&gt;
| CuviFeaturesCriteria&lt;br /&gt;
| A structure containing various parameters that affect optical flow calculation &lt;br /&gt;
|-&lt;br /&gt;
| stream&lt;br /&gt;
| CuviStream*&lt;br /&gt;
| GPU stream ID for execution&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Image Type Support===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Input&lt;br /&gt;
! Output&lt;br /&gt;
|-&lt;br /&gt;
| 2x 8uC1&lt;br /&gt;
| 2x Cuvi32f*&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Samples===&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[File:OF_frame1.png|frame|First Input Image (8-bit)]]&lt;br /&gt;
|[[File:OF_frame2.png|frame|Second Input Image (8-bit)]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:OF_flowMag.png|frame| Optical Flow Magnitude]]&lt;br /&gt;
|[[File:OF_sparseFlow.png|frame| Flow of selected points]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
{|&lt;br /&gt;
|style=&amp;quot;font-size:150%;&amp;quot;|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Image size&lt;br /&gt;
CuviSize size = cuviSize(width,height);&lt;br /&gt;
&lt;br /&gt;
//Create two 8-bit Grays-scale CuviImage objects&lt;br /&gt;
CuviImage* gimg1 = new CuviImage(size,8,1);&lt;br /&gt;
CuviImage* gimg2 = new CuviImage(size,8,1);&lt;br /&gt;
&lt;br /&gt;
//Populate the GPU Images&lt;br /&gt;
gimg1-&amp;gt;upload(img1-&amp;gt;imageData,img1-&amp;gt;widthStep);&lt;br /&gt;
gimg2-&amp;gt;upload(img2-&amp;gt;imageData,img2-&amp;gt;widthStep);&lt;br /&gt;
&lt;br /&gt;
Cuvi32f* flowX = new float[width * height];&lt;br /&gt;
Cuvi32f* flowY = new float[width * height];&lt;br /&gt;
&lt;br /&gt;
//tracking criteria&lt;br /&gt;
CuviTrackingCriteria tc = cuviTrackingCriteria(2,cuviSize(12,12));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Compute optical flow between first frame and second frame&lt;br /&gt;
cuvi::computerVision::opticalFlowPyrLKDense(gimg1,gimg2,flowX,flowY,tc);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Ghazanfar</name></author>
	</entry>
</feed>