warpers.hpp 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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 { return makePtr<detail::PlaneWarper>(scale); }
  63. };
  64. /** @brief Cylindrical warper factory class.
  65. @sa detail::CylindricalWarper
  66. */
  67. class CylindricalWarper: public WarperCreator
  68. {
  69. public:
  70. Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::CylindricalWarper>(scale); }
  71. };
  72. /** @brief Spherical warper factory class */
  73. class SphericalWarper: public WarperCreator
  74. {
  75. public:
  76. Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::SphericalWarper>(scale); }
  77. };
  78. class FisheyeWarper : public WarperCreator
  79. {
  80. public:
  81. Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::FisheyeWarper>(scale); }
  82. };
  83. class StereographicWarper: public WarperCreator
  84. {
  85. public:
  86. Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::StereographicWarper>(scale); }
  87. };
  88. class CompressedRectilinearWarper: public WarperCreator
  89. {
  90. float a, b;
  91. public:
  92. CompressedRectilinearWarper(float A = 1, float B = 1)
  93. {
  94. a = A; b = B;
  95. }
  96. Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::CompressedRectilinearWarper>(scale, a, b); }
  97. };
  98. class CompressedRectilinearPortraitWarper: public WarperCreator
  99. {
  100. float a, b;
  101. public:
  102. CompressedRectilinearPortraitWarper(float A = 1, float B = 1)
  103. {
  104. a = A; b = B;
  105. }
  106. Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::CompressedRectilinearPortraitWarper>(scale, a, b); }
  107. };
  108. class PaniniWarper: public WarperCreator
  109. {
  110. float a, b;
  111. public:
  112. PaniniWarper(float A = 1, float B = 1)
  113. {
  114. a = A; b = B;
  115. }
  116. Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::PaniniWarper>(scale, a, b); }
  117. };
  118. class PaniniPortraitWarper: public WarperCreator
  119. {
  120. float a, b;
  121. public:
  122. PaniniPortraitWarper(float A = 1, float B = 1)
  123. {
  124. a = A; b = B;
  125. }
  126. Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::PaniniPortraitWarper>(scale, a, b); }
  127. };
  128. class MercatorWarper: public WarperCreator
  129. {
  130. public:
  131. Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::MercatorWarper>(scale); }
  132. };
  133. class TransverseMercatorWarper: public WarperCreator
  134. {
  135. public:
  136. Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::TransverseMercatorWarper>(scale); }
  137. };
  138. #ifdef HAVE_OPENCV_CUDAWARPING
  139. class PlaneWarperGpu: public WarperCreator
  140. {
  141. public:
  142. Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::PlaneWarperGpu>(scale); }
  143. };
  144. class CylindricalWarperGpu: public WarperCreator
  145. {
  146. public:
  147. Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::CylindricalWarperGpu>(scale); }
  148. };
  149. class SphericalWarperGpu: public WarperCreator
  150. {
  151. public:
  152. Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::SphericalWarperGpu>(scale); }
  153. };
  154. #endif
  155. //! @} stitching_warp
  156. } // namespace cv
  157. #endif // __OPENCV_STITCHING_WARPER_CREATORS_HPP__