optical_flow.hpp 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. #ifndef __OPENCV_SUPERRES_OPTICAL_FLOW_HPP__
  43. #define __OPENCV_SUPERRES_OPTICAL_FLOW_HPP__
  44. #include "opencv2/core.hpp"
  45. namespace cv
  46. {
  47. namespace superres
  48. {
  49. //! @addtogroup superres
  50. //! @{
  51. class CV_EXPORTS DenseOpticalFlowExt : public cv::Algorithm
  52. {
  53. public:
  54. virtual void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2 = noArray()) = 0;
  55. virtual void collectGarbage() = 0;
  56. };
  57. class CV_EXPORTS FarnebackOpticalFlow : public virtual DenseOpticalFlowExt
  58. {
  59. public:
  60. /** @see setPyrScale */
  61. virtual double getPyrScale() const = 0;
  62. /** @copybrief getPyrScale @see getPyrScale */
  63. virtual void setPyrScale(double val) = 0;
  64. /** @see setLevelsNumber */
  65. virtual int getLevelsNumber() const = 0;
  66. /** @copybrief getLevelsNumber @see getLevelsNumber */
  67. virtual void setLevelsNumber(int val) = 0;
  68. /** @see setWindowSize */
  69. virtual int getWindowSize() const = 0;
  70. /** @copybrief getWindowSize @see getWindowSize */
  71. virtual void setWindowSize(int val) = 0;
  72. /** @see setIterations */
  73. virtual int getIterations() const = 0;
  74. /** @copybrief getIterations @see getIterations */
  75. virtual void setIterations(int val) = 0;
  76. /** @see setPolyN */
  77. virtual int getPolyN() const = 0;
  78. /** @copybrief getPolyN @see getPolyN */
  79. virtual void setPolyN(int val) = 0;
  80. /** @see setPolySigma */
  81. virtual double getPolySigma() const = 0;
  82. /** @copybrief getPolySigma @see getPolySigma */
  83. virtual void setPolySigma(double val) = 0;
  84. /** @see setFlags */
  85. virtual int getFlags() const = 0;
  86. /** @copybrief getFlags @see getFlags */
  87. virtual void setFlags(int val) = 0;
  88. };
  89. CV_EXPORTS Ptr<FarnebackOpticalFlow> createOptFlow_Farneback();
  90. CV_EXPORTS Ptr<FarnebackOpticalFlow> createOptFlow_Farneback_CUDA();
  91. // CV_EXPORTS Ptr<DenseOpticalFlowExt> createOptFlow_Simple();
  92. class CV_EXPORTS DualTVL1OpticalFlow : public virtual DenseOpticalFlowExt
  93. {
  94. public:
  95. /** @see setTau */
  96. virtual double getTau() const = 0;
  97. /** @copybrief getTau @see getTau */
  98. virtual void setTau(double val) = 0;
  99. /** @see setLambda */
  100. virtual double getLambda() const = 0;
  101. /** @copybrief getLambda @see getLambda */
  102. virtual void setLambda(double val) = 0;
  103. /** @see setTheta */
  104. virtual double getTheta() const = 0;
  105. /** @copybrief getTheta @see getTheta */
  106. virtual void setTheta(double val) = 0;
  107. /** @see setScalesNumber */
  108. virtual int getScalesNumber() const = 0;
  109. /** @copybrief getScalesNumber @see getScalesNumber */
  110. virtual void setScalesNumber(int val) = 0;
  111. /** @see setWarpingsNumber */
  112. virtual int getWarpingsNumber() const = 0;
  113. /** @copybrief getWarpingsNumber @see getWarpingsNumber */
  114. virtual void setWarpingsNumber(int val) = 0;
  115. /** @see setEpsilon */
  116. virtual double getEpsilon() const = 0;
  117. /** @copybrief getEpsilon @see getEpsilon */
  118. virtual void setEpsilon(double val) = 0;
  119. /** @see setIterations */
  120. virtual int getIterations() const = 0;
  121. /** @copybrief getIterations @see getIterations */
  122. virtual void setIterations(int val) = 0;
  123. /** @see setUseInitialFlow */
  124. virtual bool getUseInitialFlow() const = 0;
  125. /** @copybrief getUseInitialFlow @see getUseInitialFlow */
  126. virtual void setUseInitialFlow(bool val) = 0;
  127. };
  128. CV_EXPORTS Ptr<DualTVL1OpticalFlow> createOptFlow_DualTVL1();
  129. CV_EXPORTS Ptr<DualTVL1OpticalFlow> createOptFlow_DualTVL1_CUDA();
  130. class CV_EXPORTS BroxOpticalFlow : public virtual DenseOpticalFlowExt
  131. {
  132. public:
  133. //! @brief Flow smoothness
  134. /** @see setAlpha */
  135. virtual double getAlpha() const = 0;
  136. /** @copybrief getAlpha @see getAlpha */
  137. virtual void setAlpha(double val) = 0;
  138. //! @brief Gradient constancy importance
  139. /** @see setGamma */
  140. virtual double getGamma() const = 0;
  141. /** @copybrief getGamma @see getGamma */
  142. virtual void setGamma(double val) = 0;
  143. //! @brief Pyramid scale factor
  144. /** @see setScaleFactor */
  145. virtual double getScaleFactor() const = 0;
  146. /** @copybrief getScaleFactor @see getScaleFactor */
  147. virtual void setScaleFactor(double val) = 0;
  148. //! @brief Number of lagged non-linearity iterations (inner loop)
  149. /** @see setInnerIterations */
  150. virtual int getInnerIterations() const = 0;
  151. /** @copybrief getInnerIterations @see getInnerIterations */
  152. virtual void setInnerIterations(int val) = 0;
  153. //! @brief Number of warping iterations (number of pyramid levels)
  154. /** @see setOuterIterations */
  155. virtual int getOuterIterations() const = 0;
  156. /** @copybrief getOuterIterations @see getOuterIterations */
  157. virtual void setOuterIterations(int val) = 0;
  158. //! @brief Number of linear system solver iterations
  159. /** @see setSolverIterations */
  160. virtual int getSolverIterations() const = 0;
  161. /** @copybrief getSolverIterations @see getSolverIterations */
  162. virtual void setSolverIterations(int val) = 0;
  163. };
  164. CV_EXPORTS Ptr<BroxOpticalFlow> createOptFlow_Brox_CUDA();
  165. class PyrLKOpticalFlow : public virtual DenseOpticalFlowExt
  166. {
  167. public:
  168. /** @see setWindowSize */
  169. virtual int getWindowSize() const = 0;
  170. /** @copybrief getWindowSize @see getWindowSize */
  171. virtual void setWindowSize(int val) = 0;
  172. /** @see setMaxLevel */
  173. virtual int getMaxLevel() const = 0;
  174. /** @copybrief getMaxLevel @see getMaxLevel */
  175. virtual void setMaxLevel(int val) = 0;
  176. /** @see setIterations */
  177. virtual int getIterations() const = 0;
  178. /** @copybrief getIterations @see getIterations */
  179. virtual void setIterations(int val) = 0;
  180. };
  181. CV_EXPORTS Ptr<PyrLKOpticalFlow> createOptFlow_PyrLK_CUDA();
  182. //! @}
  183. }
  184. }
  185. #endif // __OPENCV_SUPERRES_OPTICAL_FLOW_HPP__