iVS3D v2.0.0
Loading...
Searching...
No Matches
FlowCalculatorCpu Class Reference

The FlowCalculatorCpu class is a hardware specific implementation of FlowCalculator. The algorithm takes two pictures and calculates a flow matrix using the Farneback algorithm. Than the flow matrix is evalutated and reduced to one single flow value. More...

#include <flowcalculatorcpu.h>

Inheritance diagram for FlowCalculatorCpu:
FlowCalculator FlowCalculator

Public Member Functions

 FlowCalculatorCpu (int numLevels=5, double pyrScale=0.5, bool fastPyramids=false, int winSize=13, int numIters=10, int polyN=5, double polySigma=1.1, int flags=0)
 FlowCalculatorCpu Constructor creates a Farneback object which is used to execute the farneback algortihm later.
 
 ~FlowCalculatorCpu ()
 FlowCalculatorCpu Destructor cleans up left over data and pointers.
 
double calculateFlow (cv::Mat fromMat, cv::Mat toMat) override
 calculateFlow computes the flow between two images and reduces the resulting flow-matrix to a single floating point value
 
 FlowCalculatorCpu (int numLevels=5, double pyrScale=0.5, bool fastPyramids=false, int winSize=13, int numIters=10, int polyN=5, double polySigma=1.1, int flags=0)
 FlowCalculatorCpu Constructor creates a Farneback object which is used to execute the farneback algortihm later.
 
 ~FlowCalculatorCpu ()
 FlowCalculatorCpu Destructor cleans up left over data and pointers.
 
double calculateFlow (cv::Mat fromMat, cv::Mat toMat) override
 calculateFlow computes the flow between two images and reduces the resulting flow-matrix to a single floating point value
 

Additional Inherited Members

- Protected Member Functions inherited from FlowCalculator
double flowMatToDouble (cv::Mat mat)
 flowMatToDouble reduces a flow-matrix to a single floating point value, if that mat was empty return -1.0
 
double flowMatToDouble (cv::Mat mat)
 flowMatToDouble reduces a flow-matrix to a single floating point value, if that mat was empty return -1.0
 

Detailed Description

The FlowCalculatorCpu class is a hardware specific implementation of FlowCalculator. The algorithm takes two pictures and calculates a flow matrix using the Farneback algorithm. Than the flow matrix is evalutated and reduced to one single flow value.

Author
Dominic Zahn
Date
2022/04/12

Constructor & Destructor Documentation

◆ FlowCalculatorCpu() [1/2]

FlowCalculatorCpu::FlowCalculatorCpu ( int  numLevels = 5,
double  pyrScale = 0.5,
bool  fastPyramids = false,
int  winSize = 13,
int  numIters = 10,
int  polyN = 5,
double  polySigma = 1.1,
int  flags = 0 
)

FlowCalculatorCpu Constructor creates a Farneback object which is used to execute the farneback algortihm later.

Parameters
numLevelsnumber of pyramid layers including the initial image; levels=1 means that no extra layers are created and only the original images are used
pyrScaleparameter, specifying the image scale (<1) to build pyramids for each image; pyr_scale=0.5 means a classical pyramid, where each next layer is twice smaller than the previous one.
fastPyramidsuses a faster calculation for
winSizeaveraging window size; larger values increase the algorithm robustness to image noise and give more chances for fast motion detection, but yield more blurred motion field.
numItersnumber of iterations the algorithm does at each pyramid level
polyNsize of the pixel neighborhood used to find polynomial expansion in each pixel; 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.
polySigmastandard deviation of the Gaussian that is used to smooth derivatives 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- OPTFLOW_USE_INITIAL_FLOW uses the input flow as an initial flow approximation.
  • OPTFLOW_FARNEBACK_GAUSSIAN uses the Gaussian \texttt{winsize}\times\texttt{winsize} filter instead of a box filter of the same size for optical flow estimation

◆ FlowCalculatorCpu() [2/2]

FlowCalculatorCpu::FlowCalculatorCpu ( int  numLevels = 5,
double  pyrScale = 0.5,
bool  fastPyramids = false,
int  winSize = 13,
int  numIters = 10,
int  polyN = 5,
double  polySigma = 1.1,
int  flags = 0 
)

FlowCalculatorCpu Constructor creates a Farneback object which is used to execute the farneback algortihm later.

Parameters
numLevelsnumber of pyramid layers including the initial image; levels=1 means that no extra layers are created and only the original images are used
pyrScaleparameter, specifying the image scale (<1) to build pyramids for each image; pyr_scale=0.5 means a classical pyramid, where each next layer is twice smaller than the previous one.
fastPyramidsuses a faster calculation for
winSizeaveraging window size; larger values increase the algorithm robustness to image noise and give more chances for fast motion detection, but yield more blurred motion field.
numItersnumber of iterations the algorithm does at each pyramid level
polyNsize of the pixel neighborhood used to find polynomial expansion in each pixel; 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.
polySigmastandard deviation of the Gaussian that is used to smooth derivatives 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- OPTFLOW_USE_INITIAL_FLOW uses the input flow as an initial flow approximation.
  • OPTFLOW_FARNEBACK_GAUSSIAN uses the Gaussian \texttt{winsize}\times\texttt{winsize} filter instead of a box filter of the same size for optical flow estimation

Member Function Documentation

◆ calculateFlow() [1/2]

double FlowCalculatorCpu::calculateFlow ( cv::Mat  fromMat,
cv::Mat  toMat 
)
overridevirtual

calculateFlow computes the flow between two images and reduces the resulting flow-matrix to a single floating point value

Parameters
fromMatcv::Mat which is the image before the posible movement
toMatcv::Mat which is the image after the posible movement
Returns
doubel which represents the movement between the images

Implements FlowCalculator.

◆ calculateFlow() [2/2]

double FlowCalculatorCpu::calculateFlow ( cv::Mat  fromMat,
cv::Mat  toMat 
)
overridevirtual

calculateFlow computes the flow between two images and reduces the resulting flow-matrix to a single floating point value

Parameters
fromMatcv::Mat which is the image before the posible movement
toMatcv::Mat which is the image after the posible movement
Returns
doubel which represents the movement between the images

Implements FlowCalculator.


The documentation for this class was generated from the following files: