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 CV_OVERRIDE { return makePtr<detail::PlaneWarper>(scale); } 69 }; 70 71 /** @brief Affine warper factory class. 72 @sa detail::AffineWarper 73 */ 74 class AffineWarper : public WarperCreator 75 { 76 public: create(float scale) const77 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::AffineWarper>(scale); } 78 }; 79 80 /** @brief Cylindrical warper factory class. 81 @sa detail::CylindricalWarper 82 */ 83 class CylindricalWarper: public WarperCreator 84 { 85 public: create(float scale) const86 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::CylindricalWarper>(scale); } 87 }; 88 89 /** @brief Spherical warper factory class */ 90 class SphericalWarper: public WarperCreator 91 { 92 public: create(float scale) const93 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::SphericalWarper>(scale); } 94 }; 95 96 class FisheyeWarper : public WarperCreator 97 { 98 public: create(float scale) const99 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::FisheyeWarper>(scale); } 100 }; 101 102 class StereographicWarper: public WarperCreator 103 { 104 public: create(float scale) const105 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::StereographicWarper>(scale); } 106 }; 107 108 class CompressedRectilinearWarper: public WarperCreator 109 { 110 float a, b; 111 public: CompressedRectilinearWarper(float A=1,float B=1)112 CompressedRectilinearWarper(float A = 1, float B = 1) 113 { 114 a = A; b = B; 115 } create(float scale) const116 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::CompressedRectilinearWarper>(scale, a, b); } 117 }; 118 119 class CompressedRectilinearPortraitWarper: public WarperCreator 120 { 121 float a, b; 122 public: CompressedRectilinearPortraitWarper(float A=1,float B=1)123 CompressedRectilinearPortraitWarper(float A = 1, float B = 1) 124 { 125 a = A; b = B; 126 } create(float scale) const127 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::CompressedRectilinearPortraitWarper>(scale, a, b); } 128 }; 129 130 class PaniniWarper: public WarperCreator 131 { 132 float a, b; 133 public: PaniniWarper(float A=1,float B=1)134 PaniniWarper(float A = 1, float B = 1) 135 { 136 a = A; b = B; 137 } create(float scale) const138 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::PaniniWarper>(scale, a, b); } 139 }; 140 141 class PaniniPortraitWarper: public WarperCreator 142 { 143 float a, b; 144 public: PaniniPortraitWarper(float A=1,float B=1)145 PaniniPortraitWarper(float A = 1, float B = 1) 146 { 147 a = A; b = B; 148 } create(float scale) const149 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::PaniniPortraitWarper>(scale, a, b); } 150 }; 151 152 class MercatorWarper: public WarperCreator 153 { 154 public: create(float scale) const155 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::MercatorWarper>(scale); } 156 }; 157 158 class TransverseMercatorWarper: public WarperCreator 159 { 160 public: create(float scale) const161 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::TransverseMercatorWarper>(scale); } 162 }; 163 164 165 166 #ifdef HAVE_OPENCV_CUDAWARPING 167 class PlaneWarperGpu: public WarperCreator 168 { 169 public: create(float scale) const170 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::PlaneWarperGpu>(scale); } 171 }; 172 173 174 class CylindricalWarperGpu: public WarperCreator 175 { 176 public: create(float scale) const177 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::CylindricalWarperGpu>(scale); } 178 }; 179 180 181 class SphericalWarperGpu: public WarperCreator 182 { 183 public: create(float scale) const184 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::SphericalWarperGpu>(scale); } 185 }; 186 #endif 187 188 //! @} stitching_warp 189 190 } // namespace cv 191 192 #endif // OPENCV_STITCHING_WARPER_CREATORS_HPP 193