OpenCV 4.5.3(日本語機械翻訳)
全て クラス 名前空間 ファイル 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
pcaflow.hpp
[詳解]
1 /*
2 By downloading, copying, installing or using the software you agree to this
3 license. If you do not agree to this license, do not download, install,
4 copy or use the software.
5
6
7 License Agreement
8 For Open Source Computer Vision Library
9 (3-clause BSD License)
10
11 Copyright (C) 2016, OpenCV Foundation, all rights reserved.
12 Third party copyrights are property of their respective owners.
13
14 Redistribution and use in source and binary forms, with or without modification,
15 are permitted provided that the following conditions are met:
16
17 * Redistributions of source code must retain the above copyright notice,
18 this list of conditions and the following disclaimer.
19
20 * Redistributions in binary form must reproduce the above copyright notice,
21 this list of conditions and the following disclaimer in the documentation
22 and/or other materials provided with the distribution.
23
24 * Neither the names of the copyright holders nor the names of the contributors
25 may be used to endorse or promote products derived from this software
26 without specific prior written permission.
27
28 This software is provided by the copyright holders and contributors "as is" and
29 any express or implied warranties, including, but not limited to, the implied
30 warranties of merchantability and fitness for a particular purpose are
31 disclaimed. In no event shall copyright holders or contributors be liable for
32 any direct, indirect, incidental, special, exemplary, or consequential damages
33 (including, but not limited to, procurement of substitute goods or services;
34 loss of use, data, or profits; or business interruption) however caused
35 and on any theory of liability, whether in contract, strict liability,
36 or tort (including negligence or otherwise) arising in any way out of
37 the use of this software, even if advised of the possibility of such damage.
38 */
39
55 #ifndef __OPENCV_OPTFLOW_PCAFLOW_HPP__
56 #define __OPENCV_OPTFLOW_PCAFLOW_HPP__
57
58 #include "opencv2/core.hpp"
59 #include "opencv2/video.hpp"
60
61 namespace cv
62{
63 namespace optflow
64{
65
68
74 class CV_EXPORTS_W PCAPrior
75{
76 private:
77 Mat L1;
78 Mat L2;
79 Mat c1;
80 Mat c2;
81
82 public:
83 PCAPrior( const char *pathToPrior );
84
85 int getPadding() const { return L1.size().height; }
86
87 int getBasisSize() const { return L1.size().width; }
88
89 void fillConstraints( float *A1, float *A2, float *b1, float *b2 ) const;
90};
91
94 class CV_EXPORTS_W OpticalFlowPCAFlow : public DenseOpticalFlow
95{
96 protected:
97 const Ptr<const PCAPrior> prior;
98 const Size basisSize;
99 const float sparseRate; // (0 .. 0.1)
100 const float retainedCornersFraction; // [0 .. 1]
101 const float occlusionsThreshold;
102 const float dampingFactor;
103 const float claheClip;
104 bool useOpenCL;
105
106 public:
116 OpticalFlowPCAFlow( Ptr<const PCAPrior> _prior = Ptr<const PCAPrior>(), const Size _basisSize = Size( 18, 14 ),
117 float _sparseRate = 0.024, float _retainedCornersFraction = 0.2,
118 float _occlusionsThreshold = 0.0003, float _dampingFactor = 0.00002, float _claheClip = 14 );
119
120 void calc( InputArray I0, InputArray I1, InputOutputArray flow ) CV_OVERRIDE;
121 void collectGarbage() CV_OVERRIDE;
122
123private:
124 void findSparseFeatures( UMat &from, UMat &to, std::vector<Point2f> &features,
125 std::vector<Point2f> &predictedFeatures ) const;
126
127 void removeOcclusions( UMat &from, UMat &to, std::vector<Point2f> &features,
128 std::vector<Point2f> &predictedFeatures ) const;
129
130 void getSystem( OutputArray AOut, OutputArray b1Out, OutputArray b2Out, const std::vector<Point2f> &features,
131 const std::vector<Point2f> &predictedFeatures, const Size size );
132
133 void getSystem( OutputArray A1Out, OutputArray A2Out, OutputArray b1Out, OutputArray b2Out,
134 const std::vector<Point2f> &features, const std::vector<Point2f> &predictedFeatures,
135 const Size size );
136
137 OpticalFlowPCAFlow& operator=( const OpticalFlowPCAFlow& ); // make it non-assignable
138};
139
143
145
146}
147}
148
149 #endif
Definition: mat.hpp:386
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition: mat.hpp:295
Definition: video/tracking.hpp:437
n-dimensional dense array class
Definition: mat.hpp:802
Template class for specifying the size of an image or rectangle.
Definition: core/types.hpp:316
Definition: mat.hpp:2402
PCAFlow algorithm.
Definition: pcaflow.hpp:95
void collectGarbage() CV_OVERRIDE
Releases all inner buffers.
void calc(InputArray I0, InputArray I1, InputOutputArray flow) CV_OVERRIDE
Calculates an optical flow.
OpticalFlowPCAFlow(Ptr< const PCAPrior > _prior=Ptr< const PCAPrior >(), const Size _basisSize=Size(18, 14), float _sparseRate=0.024, float _retainedCornersFraction=0.2, float _occlusionsThreshold=0.0003, float _dampingFactor=0.00002, float _claheClip=14)
Creates an instance of PCAFlow algorithm.
This class can be used for imposing a learned prior on the resulting optical flow....
Definition: pcaflow.hpp:75
CV_EXPORTS_W Ptr< DenseOpticalFlow > createOptFlow_PCAFlow()
Creates an instance of PCAFlow
cv
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
Definition: features2d.hpp:910
Definition: features2d.hpp:894
Definition: cvstd_wrapper.hpp:74