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_STITCHING_WARPER_CREATORS_HPP__ 44 #define __OPENCV_STITCHING_WARPER_CREATORS_HPP__ 45 46 #include "opencv2/stitching/detail/warpers.hpp" 47 48 namespace cv { 49 50 //! @addtogroup stitching_warp 51 //! @{ 52 53 /** @brief Image warper factories base class. 54 */ 55 class WarperCreator 56 { 57 public: ~WarperCreator()58 virtual ~WarperCreator() {} 59 virtual Ptr<detail::RotationWarper> create(float scale) const = 0; 60 }; 61 62 /** @brief Plane warper factory class. 63 @sa detail::PlaneWarper 64 */ 65 class PlaneWarper : public WarperCreator 66 { 67 public: create(float scale) const68 Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::PlaneWarper>(scale); } 69 }; 70 71 /** @brief Cylindrical warper factory class. 72 @sa detail::CylindricalWarper 73 */ 74 class CylindricalWarper: public WarperCreator 75 { 76 public: create(float scale) const77 Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::CylindricalWarper>(scale); } 78 }; 79 80 /** @brief Spherical warper factory class */ 81 class SphericalWarper: public WarperCreator 82 { 83 public: create(float scale) const84 Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::SphericalWarper>(scale); } 85 }; 86 87 class FisheyeWarper : public WarperCreator 88 { 89 public: create(float scale) const90 Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::FisheyeWarper>(scale); } 91 }; 92 93 class StereographicWarper: public WarperCreator 94 { 95 public: create(float scale) const96 Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::StereographicWarper>(scale); } 97 }; 98 99 class CompressedRectilinearWarper: public WarperCreator 100 { 101 float a, b; 102 public: CompressedRectilinearWarper(float A=1,float B=1)103 CompressedRectilinearWarper(float A = 1, float B = 1) 104 { 105 a = A; b = B; 106 } create(float scale) const107 Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::CompressedRectilinearWarper>(scale, a, b); } 108 }; 109 110 class CompressedRectilinearPortraitWarper: public WarperCreator 111 { 112 float a, b; 113 public: CompressedRectilinearPortraitWarper(float A=1,float B=1)114 CompressedRectilinearPortraitWarper(float A = 1, float B = 1) 115 { 116 a = A; b = B; 117 } create(float scale) const118 Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::CompressedRectilinearPortraitWarper>(scale, a, b); } 119 }; 120 121 class PaniniWarper: public WarperCreator 122 { 123 float a, b; 124 public: PaniniWarper(float A=1,float B=1)125 PaniniWarper(float A = 1, float B = 1) 126 { 127 a = A; b = B; 128 } create(float scale) const129 Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::PaniniWarper>(scale, a, b); } 130 }; 131 132 class PaniniPortraitWarper: public WarperCreator 133 { 134 float a, b; 135 public: PaniniPortraitWarper(float A=1,float B=1)136 PaniniPortraitWarper(float A = 1, float B = 1) 137 { 138 a = A; b = B; 139 } create(float scale) const140 Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::PaniniPortraitWarper>(scale, a, b); } 141 }; 142 143 class MercatorWarper: public WarperCreator 144 { 145 public: create(float scale) const146 Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::MercatorWarper>(scale); } 147 }; 148 149 class TransverseMercatorWarper: public WarperCreator 150 { 151 public: create(float scale) const152 Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::TransverseMercatorWarper>(scale); } 153 }; 154 155 156 157 #ifdef HAVE_OPENCV_CUDAWARPING 158 class PlaneWarperGpu: public WarperCreator 159 { 160 public: create(float scale) const161 Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::PlaneWarperGpu>(scale); } 162 }; 163 164 165 class CylindricalWarperGpu: public WarperCreator 166 { 167 public: create(float scale) const168 Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::CylindricalWarperGpu>(scale); } 169 }; 170 171 172 class SphericalWarperGpu: public WarperCreator 173 { 174 public: create(float scale) const175 Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::SphericalWarperGpu>(scale); } 176 }; 177 #endif 178 179 //! @} stitching_warp 180 181 } // namespace cv 182 183 #endif // __OPENCV_STITCHING_WARPER_CREATORS_HPP__ 184