1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 //  By downloading, copying, installing or using the software you agree to this license.
6 //  If you do not agree to this license, do not download, install,
7 //  copy or use the software.
8 //
9 //
10 //                           License Agreement
11 //                For Open Source Computer Vision Library
12 //
13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15 // Third party copyrights are property of their respective owners.
16 //
17 // Redistribution and use in source and binary forms, with or without modification,
18 // are permitted provided that the following conditions are met:
19 //
20 //   * Redistribution's of source code must retain the above copyright notice,
21 //     this list of conditions and the following disclaimer.
22 //
23 //   * Redistribution's in binary form must reproduce the above copyright notice,
24 //     this list of conditions and the following disclaimer in the documentation
25 //     and/or other materials provided with the distribution.
26 //
27 //   * The name of the copyright holders may not be used to endorse or promote products
28 //     derived from this software without specific prior written permission.
29 //
30 // This software is provided by the copyright holders and contributors "as is" and
31 // any express or implied warranties, including, but not limited to, the implied
32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
33 // In no event shall the Intel Corporation or contributors be liable for any direct,
34 // indirect, incidental, special, exemplary, or consequential damages
35 // (including, but not limited to, procurement of substitute goods or services;
36 // loss of use, data, or profits; or business interruption) however caused
37 // and on any theory of liability, whether in contract, strict liability,
38 // or tort (including negligence or otherwise) arising in any way out of
39 // the use of this software, even if advised of the possibility of such damage.
40 //
41 //M*/
42 
43 #ifndef __OPENCV_SUPERRES_OPTICAL_FLOW_HPP__
44 #define __OPENCV_SUPERRES_OPTICAL_FLOW_HPP__
45 
46 #include "opencv2/core.hpp"
47 
48 namespace cv
49 {
50     namespace superres
51     {
52 
53 //! @addtogroup superres
54 //! @{
55 
56         class CV_EXPORTS DenseOpticalFlowExt : public cv::Algorithm
57         {
58         public:
59             virtual void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2 = noArray()) = 0;
60             virtual void collectGarbage() = 0;
61         };
62 
63 
64         class CV_EXPORTS FarnebackOpticalFlow : public virtual DenseOpticalFlowExt
65         {
66         public:
67             /** @see setPyrScale */
68             virtual double getPyrScale() const = 0;
69             /** @copybrief getPyrScale @see getPyrScale */
70             virtual void setPyrScale(double val) = 0;
71             /** @see setLevelsNumber */
72             virtual int getLevelsNumber() const = 0;
73             /** @copybrief getLevelsNumber @see getLevelsNumber */
74             virtual void setLevelsNumber(int val) = 0;
75             /** @see setWindowSize */
76             virtual int getWindowSize() const = 0;
77             /** @copybrief getWindowSize @see getWindowSize */
78             virtual void setWindowSize(int val) = 0;
79             /** @see setIterations */
80             virtual int getIterations() const = 0;
81             /** @copybrief getIterations @see getIterations */
82             virtual void setIterations(int val) = 0;
83             /** @see setPolyN */
84             virtual int getPolyN() const = 0;
85             /** @copybrief getPolyN @see getPolyN */
86             virtual void setPolyN(int val) = 0;
87             /** @see setPolySigma */
88             virtual double getPolySigma() const = 0;
89             /** @copybrief getPolySigma @see getPolySigma */
90             virtual void setPolySigma(double val) = 0;
91             /** @see setFlags */
92             virtual int getFlags() const = 0;
93             /** @copybrief getFlags @see getFlags */
94             virtual void setFlags(int val) = 0;
95         };
96         CV_EXPORTS Ptr<FarnebackOpticalFlow> createOptFlow_Farneback();
97         CV_EXPORTS Ptr<FarnebackOpticalFlow> createOptFlow_Farneback_CUDA();
98 
99 
100 //        CV_EXPORTS Ptr<DenseOpticalFlowExt> createOptFlow_Simple();
101 
102 
103         class CV_EXPORTS DualTVL1OpticalFlow : public virtual DenseOpticalFlowExt
104         {
105         public:
106             /** @see setTau */
107             virtual double getTau() const = 0;
108             /** @copybrief getTau @see getTau */
109             virtual void setTau(double val) = 0;
110             /** @see setLambda */
111             virtual double getLambda() const = 0;
112             /** @copybrief getLambda @see getLambda */
113             virtual void setLambda(double val) = 0;
114             /** @see setTheta */
115             virtual double getTheta() const = 0;
116             /** @copybrief getTheta @see getTheta */
117             virtual void setTheta(double val) = 0;
118             /** @see setScalesNumber */
119             virtual int getScalesNumber() const = 0;
120             /** @copybrief getScalesNumber @see getScalesNumber */
121             virtual void setScalesNumber(int val) = 0;
122             /** @see setWarpingsNumber */
123             virtual int getWarpingsNumber() const = 0;
124             /** @copybrief getWarpingsNumber @see getWarpingsNumber */
125             virtual void setWarpingsNumber(int val) = 0;
126             /** @see setEpsilon */
127             virtual double getEpsilon() const = 0;
128             /** @copybrief getEpsilon @see getEpsilon */
129             virtual void setEpsilon(double val) = 0;
130             /** @see setIterations */
131             virtual int getIterations() const = 0;
132             /** @copybrief getIterations @see getIterations */
133             virtual void setIterations(int val) = 0;
134             /** @see setUseInitialFlow */
135             virtual bool getUseInitialFlow() const = 0;
136             /** @copybrief getUseInitialFlow @see getUseInitialFlow */
137             virtual void setUseInitialFlow(bool val) = 0;
138         };
139         CV_EXPORTS Ptr<DualTVL1OpticalFlow> createOptFlow_DualTVL1();
140         CV_EXPORTS Ptr<DualTVL1OpticalFlow> createOptFlow_DualTVL1_CUDA();
141 
142 
143         class CV_EXPORTS BroxOpticalFlow : public virtual DenseOpticalFlowExt
144         {
145         public:
146             //! @brief Flow smoothness
147             /** @see setAlpha */
148             virtual double getAlpha() const = 0;
149             /** @copybrief getAlpha @see getAlpha */
150             virtual void setAlpha(double val) = 0;
151             //! @brief Gradient constancy importance
152             /** @see setGamma */
153             virtual double getGamma() const = 0;
154             /** @copybrief getGamma @see getGamma */
155             virtual void setGamma(double val) = 0;
156             //! @brief Pyramid scale factor
157             /** @see setScaleFactor */
158             virtual double getScaleFactor() const = 0;
159             /** @copybrief getScaleFactor @see getScaleFactor */
160             virtual void setScaleFactor(double val) = 0;
161             //! @brief Number of lagged non-linearity iterations (inner loop)
162             /** @see setInnerIterations */
163             virtual int getInnerIterations() const = 0;
164             /** @copybrief getInnerIterations @see getInnerIterations */
165             virtual void setInnerIterations(int val) = 0;
166             //! @brief Number of warping iterations (number of pyramid levels)
167             /** @see setOuterIterations */
168             virtual int getOuterIterations() const = 0;
169             /** @copybrief getOuterIterations @see getOuterIterations */
170             virtual void setOuterIterations(int val) = 0;
171             //! @brief Number of linear system solver iterations
172             /** @see setSolverIterations */
173             virtual int getSolverIterations() const = 0;
174             /** @copybrief getSolverIterations @see getSolverIterations */
175             virtual void setSolverIterations(int val) = 0;
176         };
177         CV_EXPORTS Ptr<BroxOpticalFlow> createOptFlow_Brox_CUDA();
178 
179 
180         class PyrLKOpticalFlow : public virtual DenseOpticalFlowExt
181         {
182         public:
183             /** @see setWindowSize */
184             virtual int getWindowSize() const = 0;
185             /** @copybrief getWindowSize @see getWindowSize */
186             virtual void setWindowSize(int val) = 0;
187             /** @see setMaxLevel */
188             virtual int getMaxLevel() const = 0;
189             /** @copybrief getMaxLevel @see getMaxLevel */
190             virtual void setMaxLevel(int val) = 0;
191             /** @see setIterations */
192             virtual int getIterations() const = 0;
193             /** @copybrief getIterations @see getIterations */
194             virtual void setIterations(int val) = 0;
195         };
196         CV_EXPORTS Ptr<PyrLKOpticalFlow> createOptFlow_PyrLK_CUDA();
197 
198 //! @}
199 
200     }
201 }
202 
203 #endif // __OPENCV_SUPERRES_OPTICAL_FLOW_HPP__
204