OpenCV453
|
クラス | |
class | cv::optflow::DualTVL1OpticalFlow |
"Dual TV L1" Optical Flow Algorithm. [詳解] | |
class | cv::optflow::PCAPrior |
This class can be used for imposing a learned prior on the resulting optical flow. Solution will be regularized according to this prior. You need to generate appropriate prior file with "learn_prior.py" script beforehand. [詳解] | |
class | cv::optflow::OpticalFlowPCAFlow |
PCAFlow algorithm. [詳解] | |
class | cv::optflow::RLOFOpticalFlowParameter |
This is used store and set up the parameters of the robust local optical flow (RLOF) algoritm. [詳解] | |
class | cv::optflow::DenseRLOFOpticalFlow |
Fast dense optical flow computation based on robust local optical flow (RLOF) algorithms and sparse-to-dense interpolation scheme. [詳解] | |
class | cv::optflow::SparseRLOFOpticalFlow |
Class used for calculation sparse optical flow and feature tracking with robust local optical flow (RLOF) algorithms. [詳解] | |
struct | cv::optflow::GPCPatchDescriptor |
struct | cv::optflow::GPCPatchSample |
class | cv::optflow::GPCTrainingSamples |
Class encapsulating training samples. [詳解] | |
struct | cv::optflow::GPCTrainingParams |
Class encapsulating training parameters. [詳解] | |
struct | cv::optflow::GPCMatchingParams |
Class encapsulating matching parameters. [詳解] | |
class | cv::optflow::GPCTree |
Class for individual tree. [詳解] | |
class | cv::optflow::GPCForest< T > |
class | cv::optflow::GPCDetails |
型定義 | |
typedef std::vector< GPCPatchSample > | cv::optflow::GPCSamplesVector |
列挙型 | |
enum | cv::optflow::SupportRegionType { cv::optflow::SR_FIXED = 0 , cv::optflow::SR_CROSS = 1 } |
enum | cv::optflow::SolverType { cv::optflow::ST_STANDART = 0 , cv::optflow::ST_BILINEAR = 1 } |
enum | cv::optflow::InterpolationType { cv::optflow::INTERP_GEO = 0 , cv::optflow::INTERP_EPIC = 1 , cv::optflow::INTERP_RIC = 2 } |
enum | cv::optflow::GPCDescType { cv::optflow::GPC_DESCRIPTOR_DCT = 0 , cv::optflow::GPC_DESCRIPTOR_WHT } |
Descriptor types for the Global Patch Collider. [詳解] | |
関数 | |
CV_EXPORTS_W void | cv::optflow::calcOpticalFlowSF (InputArray from, InputArray to, OutputArray flow, int layers, int averaging_block_size, int max_flow) |
CV_EXPORTS_W void | cv::optflow::calcOpticalFlowSF (InputArray from, InputArray to, OutputArray flow, int layers, int averaging_block_size, int max_flow, double sigma_dist, double sigma_color, int postprocess_window, double sigma_dist_fix, double sigma_color_fix, double occ_thr, int upscale_averaging_radius, double upscale_sigma_dist, double upscale_sigma_color, double speed_up_thr) |
Calculate an optical flow using "SimpleFlow" algorithm. [詳解] | |
CV_EXPORTS_W void | cv::optflow::calcOpticalFlowSparseToDense (InputArray from, InputArray to, OutputArray flow, int grid_step=8, int k=128, float sigma=0.05f, bool use_post_proc=true, float fgs_lambda=500.0f, float fgs_sigma=1.5f) |
Fast dense optical flow based on PyrLK sparse matches interpolation. [詳解] | |
CV_EXPORTS_W Ptr< DenseOpticalFlow > | cv::optflow::createOptFlow_DeepFlow () |
DeepFlow optical flow algorithm implementation. [詳解] | |
CV_EXPORTS_W Ptr< DenseOpticalFlow > | cv::optflow::createOptFlow_SimpleFlow () |
Additional interface to the SimpleFlow algorithm - calcOpticalFlowSF() | |
CV_EXPORTS_W Ptr< DenseOpticalFlow > | cv::optflow::createOptFlow_Farneback () |
Additional interface to the Farneback's algorithm - calcOpticalFlowFarneback() | |
CV_EXPORTS_W Ptr< DenseOpticalFlow > | cv::optflow::createOptFlow_SparseToDense () |
Additional interface to the SparseToDenseFlow algorithm - calcOpticalFlowSparseToDense() | |
CV_EXPORTS_W Ptr< DualTVL1OpticalFlow > | cv::optflow::createOptFlow_DualTVL1 () |
Creates instance of cv::DenseOpticalFlow | |
CV_EXPORTS_W void | cv::motempl::updateMotionHistory (InputArray silhouette, InputOutputArray mhi, double timestamp, double duration) |
Updates the motion history image by a moving silhouette. [詳解] | |
CV_EXPORTS_W void | cv::motempl::calcMotionGradient (InputArray mhi, OutputArray mask, OutputArray orientation, double delta1, double delta2, int apertureSize=3) |
Calculates a gradient orientation of a motion history image. [詳解] | |
CV_EXPORTS_W double | cv::motempl::calcGlobalOrientation (InputArray orientation, InputArray mask, InputArray mhi, double timestamp, double duration) |
Calculates a global motion orientation in a selected region. [詳解] | |
CV_EXPORTS_W void | cv::motempl::segmentMotion (InputArray mhi, OutputArray segmask, CV_OUT std::vector< Rect > &boundingRects, double timestamp, double segThresh) |
Splits a motion history image into a few parts corresponding to separate independent motions (for example, left hand, right hand). [詳解] | |
CV_EXPORTS_W Ptr< DenseOpticalFlow > | cv::optflow::createOptFlow_PCAFlow () |
Creates an instance of PCAFlow | |
CV_EXPORTS_W void | cv::optflow::calcOpticalFlowDenseRLOF (InputArray I0, InputArray I1, InputOutputArray flow, Ptr< RLOFOpticalFlowParameter > rlofParam=Ptr< RLOFOpticalFlowParameter >(), float forwardBackwardThreshold=0, Size gridStep=Size(6, 6), InterpolationType interp_type=InterpolationType::INTERP_EPIC, int epicK=128, float epicSigma=0.05f, float epicLambda=100.f, int ricSPSize=15, int ricSLICType=100, bool use_post_proc=true, float fgsLambda=500.0f, float fgsSigma=1.5f, bool use_variational_refinement=false) |
Fast dense optical flow computation based on robust local optical flow (RLOF) algorithms and sparse-to-dense interpolation scheme. [詳解] | |
CV_EXPORTS_W void | cv::optflow::calcOpticalFlowSparseRLOF (InputArray prevImg, InputArray nextImg, InputArray prevPts, InputOutputArray nextPts, OutputArray status, OutputArray err, Ptr< RLOFOpticalFlowParameter > rlofParam=Ptr< RLOFOpticalFlowParameter >(), float forwardBackwardThreshold=0) |
Calculates fast optical flow for a sparse feature set using the robust local optical flow (RLOF) similar to optflow::calcOpticalFlowPyrLK(). [詳解] | |
CV_EXPORTS_W Ptr< DenseOpticalFlow > | cv::optflow::createOptFlow_DenseRLOF () |
Additional interface to the Dense RLOF algorithm - optflow::calcOpticalFlowDenseRLOF() | |
CV_EXPORTS_W Ptr< SparseOpticalFlow > | cv::optflow::createOptFlow_SparseRLOF () |
Additional interface to the Sparse RLOF algorithm - optflow::calcOpticalFlowSparseRLOF() | |
void | cv::optflow::GPCForest< T >::findCorrespondences (InputArray imgFrom, InputArray imgTo, std::vector< std::pair< Point2i, Point2i > > &corr, const GPCMatchingParams params=GPCMatchingParams()) const |
Find correspondences between two images. [詳解] | |
Dense optical flow algorithms compute motion for each point:
Motion templates is alternative technique for detecting motion and computing its direction. See samples/motempl.py.
Functions reading and writing .flo files in "Middlebury" format, see: http://vision.middlebury.edu/flow/code/flow-code/README.txt
CV_EXPORTS_W double cv::motempl::calcGlobalOrientation | ( | InputArray | orientation, |
InputArray | mask, | ||
InputArray | mhi, | ||
double | timestamp, | ||
double | duration | ||
) |
Calculates a global motion orientation in a selected region.
orientation | Motion gradient orientation image calculated by the function calcMotionGradient |
mask | Mask image. It may be a conjunction of a valid gradient mask, also calculated by calcMotionGradient , and the mask of a region whose direction needs to be calculated. |
mhi | Motion history image calculated by updateMotionHistory . |
timestamp | Timestamp passed to updateMotionHistory . |
duration | Maximum duration of a motion track in milliseconds, passed to updateMotionHistory |
The function calculates an average motion direction in the selected region and returns the angle between 0 degrees and 360 degrees. The average direction is computed from the weighted orientation histogram, where a recent motion has a larger weight and the motion occurred in the past has a smaller weight, as recorded in mhi .
CV_EXPORTS_W void cv::motempl::calcMotionGradient | ( | InputArray | mhi, |
OutputArray | mask, | ||
OutputArray | orientation, | ||
double | delta1, | ||
double | delta2, | ||
int | apertureSize = 3 |
||
) |
Calculates a gradient orientation of a motion history image.
mhi | Motion history single-channel floating-point image. |
mask | Output mask image that has the type CV_8UC1 and the same size as mhi . Its non-zero elements mark pixels where the motion gradient data is correct. |
orientation | Output motion gradient orientation image that has the same type and the same size as mhi . Each pixel of the image is a motion orientation, from 0 to 360 degrees. |
delta1 | Minimal (or maximal) allowed difference between mhi values within a pixel neighborhood. |
delta2 | Maximal (or minimal) allowed difference between mhi values within a pixel neighborhood. That is, the function finds the minimum ( ![]() ![]() ![]() ![]()
|
apertureSize | Aperture size of the Sobel operator. |
The function calculates a gradient orientation at each pixel as:
In fact, fastAtan2 and phase are used so that the computed angle is measured in degrees and covers the full range 0..360. Also, the mask is filled to indicate pixels where the computed angle is valid.
CV_EXPORTS_W void cv::optflow::calcOpticalFlowDenseRLOF | ( | InputArray | I0, |
InputArray | I1, | ||
InputOutputArray | flow, | ||
Ptr< RLOFOpticalFlowParameter > | rlofParam = Ptr< RLOFOpticalFlowParameter >() , |
||
float | forwardBackwardThreshold = 0 , |
||
Size | gridStep = Size(6, 6) , |
||
InterpolationType | interp_type = InterpolationType::INTERP_EPIC , |
||
int | epicK = 128 , |
||
float | epicSigma = 0.05f , |
||
float | epicLambda = 100.f , |
||
int | ricSPSize = 15 , |
||
int | ricSLICType = 100 , |
||
bool | use_post_proc = true , |
||
float | fgsLambda = 500.0f , |
||
float | fgsSigma = 1.5f , |
||
bool | use_variational_refinement = false |
||
) |
Fast dense optical flow computation based on robust local optical flow (RLOF) algorithms and sparse-to-dense interpolation scheme.
The RLOF is a fast local optical flow approach described in [Senst2012] [Senst2013] [Senst2014] and [Senst2016] similar to the pyramidal iterative Lucas-Kanade method as proposed by [Bouguet00]. More details and experiments can be found in the following thesis [Senst2019]. The implementation is derived from optflow::calcOpticalFlowPyrLK().
The sparse-to-dense interpolation scheme allows for fast computation of dense optical flow using RLOF (see [Geistert2016]). For this scheme the following steps are applied:
I0 | first 8-bit input image. If The cross-based RLOF is used (by selecting optflow::RLOFOpticalFlowParameter::supportRegionType = SupportRegionType::SR_CROSS) image has to be a 8-bit 3 channel image. |
I1 | second 8-bit input image. If The cross-based RLOF is used (by selecting optflow::RLOFOpticalFlowParameter::supportRegionType = SupportRegionType::SR_CROSS) image has to be a 8-bit 3 channel image. |
flow | computed flow image that has the same size as I0 and type CV_32FC2. |
rlofParam | see optflow::RLOFOpticalFlowParameter |
forwardBackwardThreshold | Threshold for the forward backward confidence check. For each grid point ![]() ![]()
![]() |
gridStep | Size of the grid to spawn the motion vectors. For each grid point a motion vector is computed. Some motion vectors will be removed due to the forwatd backward threshold (if set >0). The rest will be the base of the vector field interpolation. |
interp_type | interpolation method used to compute the dense optical flow. Two interpolation algorithms are supported:
|
epicK | see ximgproc::EdgeAwareInterpolator sets the respective parameter. |
epicSigma | see ximgproc::EdgeAwareInterpolator sets the respective parameter. |
epicLambda | see ximgproc::EdgeAwareInterpolator sets the respective parameter. |
ricSPSize | see ximgproc::RICInterpolator sets the respective parameter. |
ricSLICType | see ximgproc::RICInterpolator sets the respective parameter. |
use_post_proc | enables ximgproc::fastGlobalSmootherFilter() parameter. |
fgsLambda | sets the respective ximgproc::fastGlobalSmootherFilter() parameter. |
fgsSigma | sets the respective ximgproc::fastGlobalSmootherFilter() parameter. |
use_variational_refinement | enables VariationalRefinement |
Parameters have been described in [Senst2012], [Senst2013], [Senst2014], [Senst2016]. For the RLOF configuration see optflow::RLOFOpticalFlowParameter for further details.
CV_EXPORTS_W void cv::optflow::calcOpticalFlowSF | ( | InputArray | from, |
InputArray | to, | ||
OutputArray | flow, | ||
int | layers, | ||
int | averaging_block_size, | ||
int | max_flow | ||
) |
これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。
CV_EXPORTS_W void cv::optflow::calcOpticalFlowSF | ( | InputArray | from, |
InputArray | to, | ||
OutputArray | flow, | ||
int | layers, | ||
int | averaging_block_size, | ||
int | max_flow, | ||
double | sigma_dist, | ||
double | sigma_color, | ||
int | postprocess_window, | ||
double | sigma_dist_fix, | ||
double | sigma_color_fix, | ||
double | occ_thr, | ||
int | upscale_averaging_radius, | ||
double | upscale_sigma_dist, | ||
double | upscale_sigma_color, | ||
double | speed_up_thr | ||
) |
Calculate an optical flow using "SimpleFlow" algorithm.
from | First 8-bit 3-channel image. |
to | Second 8-bit 3-channel image of the same size as prev |
flow | computed flow image that has the same size as prev and type CV_32FC2 |
layers | Number of layers |
averaging_block_size | Size of block through which we sum up when calculate cost function for pixel |
max_flow | maximal flow that we search at each level |
sigma_dist | vector smooth spatial sigma parameter |
sigma_color | vector smooth color sigma parameter |
postprocess_window | window size for postprocess cross bilateral filter |
sigma_dist_fix | spatial sigma for postprocess cross bilateralf filter |
sigma_color_fix | color sigma for postprocess cross bilateral filter |
occ_thr | threshold for detecting occlusions |
upscale_averaging_radius | window size for bilateral upscale operation |
upscale_sigma_dist | spatial sigma for bilateral upscale operation |
upscale_sigma_color | color sigma for bilateral upscale operation |
speed_up_thr | threshold to detect point with irregular flow - where flow should be recalculated after upscale |
See [Tao2012] . And site of project - http://graphics.berkeley.edu/papers/Tao-SAN-2012-05/.
CV_EXPORTS_W void cv::optflow::calcOpticalFlowSparseRLOF | ( | InputArray | prevImg, |
InputArray | nextImg, | ||
InputArray | prevPts, | ||
InputOutputArray | nextPts, | ||
OutputArray | status, | ||
OutputArray | err, | ||
Ptr< RLOFOpticalFlowParameter > | rlofParam = Ptr< RLOFOpticalFlowParameter >() , |
||
float | forwardBackwardThreshold = 0 |
||
) |
Calculates fast optical flow for a sparse feature set using the robust local optical flow (RLOF) similar to optflow::calcOpticalFlowPyrLK().
The RLOF is a fast local optical flow approach described in [Senst2012] [Senst2013] [Senst2014] and [Senst2016] similar to the pyramidal iterative Lucas-Kanade method as proposed by [Bouguet00]. More details and experiments can be found in the following thesis [Senst2019]. The implementation is derived from optflow::calcOpticalFlowPyrLK().
prevImg | first 8-bit input image. If The cross-based RLOF is used (by selecting optflow::RLOFOpticalFlowParameter::supportRegionType = SupportRegionType::SR_CROSS) image has to be a 8-bit 3 channel image. |
nextImg | second 8-bit input image. If The cross-based RLOF is used (by selecting optflow::RLOFOpticalFlowParameter::supportRegionType = SupportRegionType::SR_CROSS) image has to be a 8-bit 3 channel image. |
prevPts | vector of 2D points for which the flow needs to be found; point coordinates must be single-precision floating-point numbers. |
nextPts | output vector of 2D points (with single-precision floating-point coordinates) containing the calculated new positions of input features in the second image; when optflow::RLOFOpticalFlowParameter::useInitialFlow variable is true the vector must have the same size as in the input and contain the initialization point correspondences. |
status | output status vector (of unsigned chars); each element of the vector is set to 1 if the flow for the corresponding features has passed the forward backward check. |
err | output vector of errors; each element of the vector is set to the forward backward error for the corresponding feature. |
rlofParam | see optflow::RLOFOpticalFlowParameter |
forwardBackwardThreshold | Threshold for the forward backward confidence check. If forewardBackwardThreshold <=0 the forward |
Parameters have been described in [Senst2012], [Senst2013], [Senst2014] and [Senst2016]. For the RLOF configuration see optflow::RLOFOpticalFlowParameter for further details.
CV_EXPORTS_W void cv::optflow::calcOpticalFlowSparseToDense | ( | InputArray | from, |
InputArray | to, | ||
OutputArray | flow, | ||
int | grid_step = 8 , |
||
int | k = 128 , |
||
float | sigma = 0.05f , |
||
bool | use_post_proc = true , |
||
float | fgs_lambda = 500.0f , |
||
float | fgs_sigma = 1.5f |
||
) |
Fast dense optical flow based on PyrLK sparse matches interpolation.
from | first 8-bit 3-channel or 1-channel image. |
to | second 8-bit 3-channel or 1-channel image of the same size as from |
flow | computed flow image that has the same size as from and CV_32FC2 type |
grid_step | stride used in sparse match computation. Lower values usually result in higher quality but slow down the algorithm. |
k | number of nearest-neighbor matches considered, when fitting a locally affine model. Lower values can make the algorithm noticeably faster at the cost of some quality degradation. |
sigma | parameter defining how fast the weights decrease in the locally-weighted affine fitting. Higher values can help preserve fine details, lower values can help to get rid of the noise in the output flow. |
use_post_proc | defines whether the ximgproc::fastGlobalSmootherFilter() is used for post-processing after interpolation |
fgs_lambda | see the respective parameter of the ximgproc::fastGlobalSmootherFilter() |
fgs_sigma | see the respective parameter of the ximgproc::fastGlobalSmootherFilter() |
CV_EXPORTS_W Ptr< DenseOpticalFlow > cv::optflow::createOptFlow_DeepFlow | ( | ) |
DeepFlow optical flow algorithm implementation.
The class implements the DeepFlow optical flow algorithm described in [Weinzaepfel2013] . See also http://lear.inrialpes.fr/src/deepmatching/ . Parameters - class fields - that may be modified after creating a class instance:
void cv::optflow::GPCForest< T >::findCorrespondences | ( | InputArray | imgFrom, |
InputArray | imgTo, | ||
std::vector< std::pair< Point2i, Point2i > > & | corr, | ||
const GPCMatchingParams | params = GPCMatchingParams() |
||
) | const |
Find correspondences between two images.
[in] | imgFrom | First image in a sequence. |
[in] | imgTo | Second image in a sequence. |
[out] | corr | Output vector with pairs of corresponding points. |
[in] | params | Additional matching parameters for fine-tuning. |
CV_EXPORTS_W void cv::motempl::segmentMotion | ( | InputArray | mhi, |
OutputArray | segmask, | ||
CV_OUT std::vector< Rect > & | boundingRects, | ||
double | timestamp, | ||
double | segThresh | ||
) |
Splits a motion history image into a few parts corresponding to separate independent motions (for example, left hand, right hand).
mhi | Motion history image. |
segmask | Image where the found mask should be stored, single-channel, 32-bit floating-point. |
boundingRects | Vector containing ROIs of motion connected components. |
timestamp | Current time in milliseconds or other units. |
segThresh | Segmentation threshold that is recommended to be equal to the interval between motion history "steps" or greater. |
The function finds all of the motion segments and marks them in segmask with individual values (1,2,...). It also computes a vector with ROIs of motion connected components. After that the motion direction for every component can be calculated with calcGlobalOrientation using the extracted mask of the particular component.
CV_EXPORTS_W void cv::motempl::updateMotionHistory | ( | InputArray | silhouette, |
InputOutputArray | mhi, | ||
double | timestamp, | ||
double | duration | ||
) |
Updates the motion history image by a moving silhouette.
silhouette | Silhouette mask that has non-zero pixels where the motion occurs. |
mhi | Motion history image that is updated by the function (single-channel, 32-bit floating-point). |
timestamp | Current time in milliseconds or other units. |
duration | Maximal duration of the motion track in the same units as timestamp . |
The function updates the motion history image as follows:
That is, MHI pixels where the motion occurs are set to the current timestamp , while the pixels where the motion happened last time a long time ago are cleared.
The function, together with calcMotionGradient and calcGlobalOrientation , implements a motion templates technique described in [Davis97] and [Bradski00] .