C# Класс Emgu.CV.OpticalFlow

Contains a collection of optical flow methods
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
BM ( Byte>.Image prev, Byte>.Image curr, Size blockSize, Size shiftSize, Size maxRange, bool usePrevious, Single>.Image velx, Single>.Image vely ) : void

Calculates optical flow for overlapped blocks block_size.width * block_size.height pixels each, thus the velocity fields are smaller than the original images. For every block in prev the functions tries to find a similar block in curr in some neighborhood of the original block or shifted by (velx(x0,y0),vely(x0,y0)) block as has been calculated by previous function call (if use_previous)

Farneback ( Byte>.Image prev0, Byte>.Image next0, Single>.Image flowX, Single>.Image flowY, double pyrScale, int levels, int winSize, int iterations, int polyN, double polySigma, CvEnum flags ) : void

Computes dense optical flow using Gunnar Farneback's algorithm

HS ( Byte>.Image prev, Byte>.Image curr, bool usePrevious, Single>.Image velx, Single>.Image vely, double lambda, MCvTermCriteria criteria ) : void

Computes flow for every pixel of the first input image using Horn & Schunck algorithm

LK ( Byte>.Image prev, Byte>.Image curr, Size winSize, Single>.Image velx, Single>.Image vely ) : void

Computes flow for every pixel of the first input image using Lucas & Kanade algorithm

PyrLK ( Byte>.Image prev, Byte>.Image curr, Byte>.Image prevPyrBuffer, Byte>.Image currPyrBuffer, PointF prevFeatures, Size winSize, int level, MCvTermCriteria criteria, Emgu flags, PointF &currFeatures, Byte &status, float &trackError ) : void

Calculates optical flow for a sparse feature set using iterative Lucas-Kanade method in pyramids

PyrLK ( Byte>.Image prev, Byte>.Image curr, PointF prevFeatures, Size winSize, int level, MCvTermCriteria criteria, PointF &currFeatures, Byte &status, float &trackError ) : void

Calculates optical flow for a sparse feature set using iterative Lucas-Kanade method in pyramids

Описание методов

BM() публичный статический Метод

Calculates optical flow for overlapped blocks block_size.width * block_size.height pixels each, thus the velocity fields are smaller than the original images. For every block in prev the functions tries to find a similar block in curr in some neighborhood of the original block or shifted by (velx(x0,y0),vely(x0,y0)) block as has been calculated by previous function call (if use_previous)
public static BM ( Byte>.Image prev, Byte>.Image curr, Size blockSize, Size shiftSize, Size maxRange, bool usePrevious, Single>.Image velx, Single>.Image vely ) : void
prev Byte>.Image First image
curr Byte>.Image Second image
blockSize System.Drawing.Size Size of basic blocks that are compared.
shiftSize System.Drawing.Size Block coordinate increments.
maxRange System.Drawing.Size Size of the scanned neighborhood in pixels around block.
usePrevious bool Uses previous (input) velocity field.
velx Single>.Image Horizontal component of the optical flow of floor((prev->width - block_size.width)/shiftSize.width) x floor((prev->height - block_size.height)/shiftSize.height) size.
vely Single>.Image Vertical component of the optical flow of the same size velx.
Результат void

Farneback() публичный статический Метод

Computes dense optical flow using Gunnar Farneback's algorithm
public static Farneback ( Byte>.Image prev0, Byte>.Image next0, Single>.Image flowX, Single>.Image flowY, double pyrScale, int levels, int winSize, int iterations, int polyN, double polySigma, CvEnum flags ) : void
prev0 Byte>.Image The first 8-bit single-channel input image
next0 Byte>.Image The second input image of the same size and the same type as prevImg
flowX Single>.Image The computed flow image for x-velocity; will have the same size as prevImg
flowY Single>.Image The computed flow image for y-velocity; will have the same size as prevImg
pyrScale double Specifies the image scale (!1) to build the pyramids for each image. pyrScale=0.5 means the classical pyramid, where each next layer is twice smaller than the previous
levels int The number of pyramid layers, including the initial image. levels=1 means that no extra layers are created and only the original images are used
winSize int The averaging window size; The larger values increase the algorithm robustness to image noise and give more chances for fast motion detection, but yield more blurred motion field
iterations int The number of iterations the algorithm does at each pyramid level
polyN int Size of the pixel neighborhood used to find polynomial expansion in each pixel. The larger values mean that the image will be approximated with smoother surfaces, yielding more robust algorithm and more blurred motion field. Typically, poly n=5 or 7
polySigma double Standard deviation of the Gaussian that is used to smooth derivatives that are used as a basis for the polynomial expansion. For poly n=5 you can set poly sigma=1.1, for poly n=7 a good value would be poly sigma=1.5
flags CvEnum The operation flags
Результат void

HS() публичный статический Метод

Computes flow for every pixel of the first input image using Horn & Schunck algorithm
public static HS ( Byte>.Image prev, Byte>.Image curr, bool usePrevious, Single>.Image velx, Single>.Image vely, double lambda, MCvTermCriteria criteria ) : void
prev Byte>.Image First image, 8-bit, single-channel
curr Byte>.Image Second image, 8-bit, single-channel
usePrevious bool Uses previous (input) velocity field
velx Single>.Image Horizontal component of the optical flow of the same size as input images, 32-bit floating-point, single-channel
vely Single>.Image Vertical component of the optical flow of the same size as input images, 32-bit floating-point, single-channel
lambda double Lagrangian multiplier
criteria Emgu.CV.Structure.MCvTermCriteria Criteria of termination of velocity computing
Результат void

LK() публичный статический Метод

Computes flow for every pixel of the first input image using Lucas & Kanade algorithm
public static LK ( Byte>.Image prev, Byte>.Image curr, Size winSize, Single>.Image velx, Single>.Image vely ) : void
prev Byte>.Image First image
curr Byte>.Image Second image
winSize System.Drawing.Size Size of the averaging window used for grouping pixels
velx Single>.Image Horizontal component of the optical flow of the same size as input images
vely Single>.Image Vertical component of the optical flow of the same size as input images
Результат void

PyrLK() публичный статический Метод

Calculates optical flow for a sparse feature set using iterative Lucas-Kanade method in pyramids
public static PyrLK ( Byte>.Image prev, Byte>.Image curr, Byte>.Image prevPyrBuffer, Byte>.Image currPyrBuffer, PointF prevFeatures, Size winSize, int level, MCvTermCriteria criteria, Emgu flags, PointF &currFeatures, Byte &status, float &trackError ) : void
prev Byte>.Image First frame, at time t
curr Byte>.Image Second frame, at time t + dt
prevPyrBuffer Byte>.Image Buffer for the pyramid for the first frame. If it is not NULL, the buffer must have a sufficient size to store the pyramid from level 1 to level #level ; the total size of (image_width+8)*image_height/3 bytes is sufficient
currPyrBuffer Byte>.Image Similar to prev_pyr, used for the second frame
prevFeatures System.Drawing.PointF Array of points for which the flow needs to be found
winSize System.Drawing.Size Size of the search window of each pyramid level
level int Maximal pyramid level number. If 0 , pyramids are not used (single level), if 1 , two levels are used, etc
criteria Emgu.CV.Structure.MCvTermCriteria Specifies when the iteration process of finding the flow for each point on each pyramid level should be stopped
flags Emgu Flags
currFeatures System.Drawing.PointF Array of 2D points containing calculated new positions of input features in the second image
status Byte Array. Every element of the array is set to 1 if the flow for the corresponding feature has been found, 0 otherwise
trackError float Array of double numbers containing difference between patches around the original and moved points
Результат void

PyrLK() публичный статический Метод

Calculates optical flow for a sparse feature set using iterative Lucas-Kanade method in pyramids
public static PyrLK ( Byte>.Image prev, Byte>.Image curr, PointF prevFeatures, Size winSize, int level, MCvTermCriteria criteria, PointF &currFeatures, Byte &status, float &trackError ) : void
prev Byte>.Image First frame, at time t
curr Byte>.Image Second frame, at time t + dt
prevFeatures System.Drawing.PointF Array of points for which the flow needs to be found
winSize System.Drawing.Size Size of the search window of each pyramid level
level int Maximal pyramid level number. If 0 , pyramids are not used (single level), if 1 , two levels are used, etc
criteria Emgu.CV.Structure.MCvTermCriteria Specifies when the iteration process of finding the flow for each point on each pyramid level should be stopped
currFeatures System.Drawing.PointF Array of 2D points containing calculated new positions of input features in the second image
status Byte Array. Every element of the array is set to 1 if the flow for the corresponding feature has been found, 0 otherwise
trackError float Array of double numbers containing difference between patches around the original and moved points
Результат void