OpenCV453
warpers.hpp
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#include <string>
48
49namespace cv {
50 class CV_EXPORTS_W PyRotationWarper
51 {
53
54 public:
55 CV_WRAP PyRotationWarper(String type, float scale);
56 CV_WRAP PyRotationWarper() {};
58
66 CV_WRAP Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R);
67
75#if CV_VERSION_MAJOR == 4
76 CV_WRAP Point2f warpPointBackward(const Point2f& pt, InputArray K, InputArray R)
77 {
78 CV_UNUSED(pt); CV_UNUSED(K); CV_UNUSED(R);
79 CV_Error(Error::StsNotImplemented, "");
80 }
81#else
82 CV_WRAP Point2f warpPointBackward(const Point2f &pt, InputArray K, InputArray R);
83#endif
93 CV_WRAP Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap);
94
105 CV_WRAP Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
106 CV_OUT OutputArray dst);
107
118 CV_WRAP void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
119 Size dst_size, CV_OUT OutputArray dst);
120
127 CV_WRAP Rect warpRoi(Size src_size, InputArray K, InputArray R);
128
129 CV_WRAP float getScale() const { return 1.f; }
130 CV_WRAP void setScale(float) {}
131 };
132
135
139class CV_EXPORTS_W WarperCreator
140{
141public:
142 CV_WRAP virtual ~WarperCreator() {}
143 virtual Ptr<detail::RotationWarper> create(float scale) const = 0;
144};
145
146
150class CV_EXPORTS PlaneWarper : public WarperCreator
151{
152public:
153 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::PlaneWarper>(scale); }
154};
155
159class CV_EXPORTS AffineWarper : public WarperCreator
160{
161public:
162 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::AffineWarper>(scale); }
163};
164
168class CV_EXPORTS CylindricalWarper: public WarperCreator
169{
170public:
171 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::CylindricalWarper>(scale); }
172};
173
175class CV_EXPORTS SphericalWarper: public WarperCreator
176{
177public:
178 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::SphericalWarper>(scale); }
179};
180
181class CV_EXPORTS FisheyeWarper : public WarperCreator
182{
183public:
184 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::FisheyeWarper>(scale); }
185};
186
187class CV_EXPORTS StereographicWarper: public WarperCreator
188{
189public:
190 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::StereographicWarper>(scale); }
191};
192
194{
195 float a, b;
196public:
197 CompressedRectilinearWarper(float A = 1, float B = 1)
198 {
199 a = A; b = B;
200 }
201 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::CompressedRectilinearWarper>(scale, a, b); }
202};
203
205{
206 float a, b;
207public:
208 CompressedRectilinearPortraitWarper(float A = 1, float B = 1)
209 {
210 a = A; b = B;
211 }
212 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::CompressedRectilinearPortraitWarper>(scale, a, b); }
213};
214
215class CV_EXPORTS PaniniWarper: public WarperCreator
216{
217 float a, b;
218public:
219 PaniniWarper(float A = 1, float B = 1)
220 {
221 a = A; b = B;
222 }
223 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::PaniniWarper>(scale, a, b); }
224};
225
226class CV_EXPORTS PaniniPortraitWarper: public WarperCreator
227{
228 float a, b;
229public:
230 PaniniPortraitWarper(float A = 1, float B = 1)
231 {
232 a = A; b = B;
233 }
234 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::PaniniPortraitWarper>(scale, a, b); }
235};
236
237class CV_EXPORTS MercatorWarper: public WarperCreator
238{
239public:
240 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::MercatorWarper>(scale); }
241};
242
244{
245public:
246 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::TransverseMercatorWarper>(scale); }
247};
248
249
250
251#ifdef HAVE_OPENCV_CUDAWARPING
252class PlaneWarperGpu: public WarperCreator
253{
254public:
255 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::PlaneWarperGpu>(scale); }
256};
257
258
259class CylindricalWarperGpu: public WarperCreator
260{
261public:
262 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::CylindricalWarperGpu>(scale); }
263};
264
265
266class SphericalWarperGpu: public WarperCreator
267{
268public:
269 Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::SphericalWarperGpu>(scale); }
270};
271#endif
272
274
275} // namespace cv
276
277#endif // OPENCV_STITCHING_WARPER_CREATORS_HPP
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition: mat.hpp:295
Affine warper factory class.
Definition: warpers.hpp:160
Definition: warpers.hpp:205
Definition: warpers.hpp:194
Cylindrical warper factory class.
Definition: warpers.hpp:169
Definition: warpers.hpp:182
Definition: warpers.hpp:238
Definition: warpers.hpp:227
Definition: warpers.hpp:216
Plane warper factory class.
Definition: warpers.hpp:151
Definition: warpers.hpp:51
Template class for 2D rectangles
Definition: core/types.hpp:421
Template class for specifying the size of an image or rectangle.
Definition: core/types.hpp:316
Spherical warper factory class
Definition: warpers.hpp:176
Definition: warpers.hpp:188
Definition: warpers.hpp:244
Image warper factories base class.
Definition: warpers.hpp:140
#define CV_Error(code, msg)
Call the error handler.
Definition: base.hpp:320
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
Definition: cvstd_wrapper.hpp:74