optical_flow.hpp
Go to the documentation of this file.
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-2011, 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_VIDEOSTAB_OPTICAL_FLOW_HPP__
44 #define __OPENCV_VIDEOSTAB_OPTICAL_FLOW_HPP__
45 
46 #include "opencv2/core/core.hpp"
48 
49 #if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
50 # include "opencv2/gpu/gpu.hpp"
51 #endif
52 
53 namespace cv
54 {
55 namespace videostab
56 {
57 
58 class CV_EXPORTS ISparseOptFlowEstimator
59 {
60 public:
62  virtual void run(
63  InputArray frame0, InputArray frame1, InputArray points0, InputOutputArray points1,
64  OutputArray status, OutputArray errors) = 0;
65 };
66 
67 class CV_EXPORTS IDenseOptFlowEstimator
68 {
69 public:
71  virtual void run(
72  InputArray frame0, InputArray frame1, InputOutputArray flowX, InputOutputArray flowY,
73  OutputArray errors) = 0;
74 };
75 
76 class CV_EXPORTS PyrLkOptFlowEstimatorBase
77 {
78 public:
79  PyrLkOptFlowEstimatorBase() { setWinSize(Size(21, 21)); setMaxLevel(3); }
80 
81  void setWinSize(Size val) { winSize_ = val; }
82  Size winSize() const { return winSize_; }
83 
84  void setMaxLevel(int val) { maxLevel_ = val; }
85  int maxLevel() const { return maxLevel_; }
86 
87 protected:
89  int maxLevel_;
90 };
91 
94 {
95 public:
96  virtual void run(
97  InputArray frame0, InputArray frame1, InputArray points0, InputOutputArray points1,
99 };
100 
101 #if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
104 {
105 public:
107 
108  virtual void run(
109  InputArray frame0, InputArray frame1, InputOutputArray flowX, InputOutputArray flowY,
110  OutputArray errors);
111 private:
112  gpu::PyrLKOpticalFlow optFlowEstimator_;
113  gpu::GpuMat frame0_, frame1_, flowX_, flowY_, errors_;
114 };
115 #endif
116 
117 } // namespace videostab
118 } // namespace cv
119 
120 #endif
const CvArr CvArr CvArr const CvPoint2D32f CvPoint2D32f int CvSize int char * status
Definition: tracking.hpp:73
Size2i Size
Definition: core.hpp:896
virtual ~IDenseOptFlowEstimator()
Definition: optical_flow.hpp:70
Definition: optical_flow.hpp:92
PyrLkOptFlowEstimatorBase()
Definition: optical_flow.hpp:79
Definition: optical_flow.hpp:67
void setWinSize(Size val)
Definition: optical_flow.hpp:81
Proxy datatype for passing Mat's and vector<>'s as input parameters.
Definition: core.hpp:1312
The 2D size class.
Definition: core.hpp:81
GLuint GLfloat * val
Definition: gpu.hpp:1813
Definition: optical_flow.hpp:102
Smart pointer for GPU memory with reference counting. Its interface is mostly similar with cv::Mat...
Definition: gpumat.hpp:154
Size winSize_
Definition: optical_flow.hpp:88
virtual ~ISparseOptFlowEstimator()
Definition: optical_flow.hpp:61
void setMaxLevel(int val)
Definition: optical_flow.hpp:84
The Core Functionality.
int maxLevel() const
Definition: optical_flow.hpp:85
Definition: optical_flow.hpp:76
int maxLevel_
Definition: optical_flow.hpp:89
Definition: optical_flow.hpp:58
CvMat * points1
Definition: calib3d.hpp:117
Proxy datatype for passing Mat's and vector<>'s as input parameters.
Definition: core.hpp:1400
Size winSize() const
Definition: optical_flow.hpp:82