warpers.hpp 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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_STITCHING_WARPER_CREATORS_HPP
  43. #define OPENCV_STITCHING_WARPER_CREATORS_HPP
  44. #include "opencv2/stitching/detail/warpers.hpp"
  45. namespace cv {
  46. //! @addtogroup stitching_warp
  47. //! @{
  48. /** @brief Image warper factories base class.
  49. */
  50. class WarperCreator
  51. {
  52. public:
  53. virtual ~WarperCreator() {}
  54. virtual Ptr<detail::RotationWarper> create(float scale) const = 0;
  55. };
  56. /** @brief Plane warper factory class.
  57. @sa detail::PlaneWarper
  58. */
  59. class PlaneWarper : public WarperCreator
  60. {
  61. public:
  62. Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::PlaneWarper>(scale); }
  63. };
  64. /** @brief Affine warper factory class.
  65. @sa detail::AffineWarper
  66. */
  67. class AffineWarper : public WarperCreator
  68. {
  69. public:
  70. Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::AffineWarper>(scale); }
  71. };
  72. /** @brief Cylindrical warper factory class.
  73. @sa detail::CylindricalWarper
  74. */
  75. class CylindricalWarper: public WarperCreator
  76. {
  77. public:
  78. Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::CylindricalWarper>(scale); }
  79. };
  80. /** @brief Spherical warper factory class */
  81. class SphericalWarper: public WarperCreator
  82. {
  83. public:
  84. Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::SphericalWarper>(scale); }
  85. };
  86. class FisheyeWarper : public WarperCreator
  87. {
  88. public:
  89. Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::FisheyeWarper>(scale); }
  90. };
  91. class StereographicWarper: public WarperCreator
  92. {
  93. public:
  94. Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::StereographicWarper>(scale); }
  95. };
  96. class CompressedRectilinearWarper: public WarperCreator
  97. {
  98. float a, b;
  99. public:
  100. CompressedRectilinearWarper(float A = 1, float B = 1)
  101. {
  102. a = A; b = B;
  103. }
  104. Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::CompressedRectilinearWarper>(scale, a, b); }
  105. };
  106. class CompressedRectilinearPortraitWarper: public WarperCreator
  107. {
  108. float a, b;
  109. public:
  110. CompressedRectilinearPortraitWarper(float A = 1, float B = 1)
  111. {
  112. a = A; b = B;
  113. }
  114. Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::CompressedRectilinearPortraitWarper>(scale, a, b); }
  115. };
  116. class PaniniWarper: public WarperCreator
  117. {
  118. float a, b;
  119. public:
  120. PaniniWarper(float A = 1, float B = 1)
  121. {
  122. a = A; b = B;
  123. }
  124. Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::PaniniWarper>(scale, a, b); }
  125. };
  126. class PaniniPortraitWarper: public WarperCreator
  127. {
  128. float a, b;
  129. public:
  130. PaniniPortraitWarper(float A = 1, float B = 1)
  131. {
  132. a = A; b = B;
  133. }
  134. Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::PaniniPortraitWarper>(scale, a, b); }
  135. };
  136. class MercatorWarper: public WarperCreator
  137. {
  138. public:
  139. Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::MercatorWarper>(scale); }
  140. };
  141. class TransverseMercatorWarper: public WarperCreator
  142. {
  143. public:
  144. Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::TransverseMercatorWarper>(scale); }
  145. };
  146. #ifdef HAVE_OPENCV_CUDAWARPING
  147. class PlaneWarperGpu: public WarperCreator
  148. {
  149. public:
  150. Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::PlaneWarperGpu>(scale); }
  151. };
  152. class CylindricalWarperGpu: public WarperCreator
  153. {
  154. public:
  155. Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::CylindricalWarperGpu>(scale); }
  156. };
  157. class SphericalWarperGpu: public WarperCreator
  158. {
  159. public:
  160. Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::SphericalWarperGpu>(scale); }
  161. };
  162. #endif
  163. //! @} stitching_warp
  164. } // namespace cv
  165. #endif // OPENCV_STITCHING_WARPER_CREATORS_HPP