openCV library for Renesas RZ/A

Dependents:   RZ_A2M_Mbed_samples

Committer:
RyoheiHagimoto
Date:
Fri Jan 29 04:53:38 2021 +0000
Revision:
0:0e0631af0305
copied from https://github.com/d-kato/opencv-lib.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RyoheiHagimoto 0:0e0631af0305 1 /*M///////////////////////////////////////////////////////////////////////////////////////
RyoheiHagimoto 0:0e0631af0305 2 //
RyoheiHagimoto 0:0e0631af0305 3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
RyoheiHagimoto 0:0e0631af0305 4 //
RyoheiHagimoto 0:0e0631af0305 5 // By downloading, copying, installing or using the software you agree to this license.
RyoheiHagimoto 0:0e0631af0305 6 // If you do not agree to this license, do not download, install,
RyoheiHagimoto 0:0e0631af0305 7 // copy or use the software.
RyoheiHagimoto 0:0e0631af0305 8 //
RyoheiHagimoto 0:0e0631af0305 9 //
RyoheiHagimoto 0:0e0631af0305 10 // License Agreement
RyoheiHagimoto 0:0e0631af0305 11 // For Open Source Computer Vision Library
RyoheiHagimoto 0:0e0631af0305 12 //
RyoheiHagimoto 0:0e0631af0305 13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
RyoheiHagimoto 0:0e0631af0305 14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
RyoheiHagimoto 0:0e0631af0305 15 // Third party copyrights are property of their respective owners.
RyoheiHagimoto 0:0e0631af0305 16 //
RyoheiHagimoto 0:0e0631af0305 17 // Redistribution and use in source and binary forms, with or without modification,
RyoheiHagimoto 0:0e0631af0305 18 // are permitted provided that the following conditions are met:
RyoheiHagimoto 0:0e0631af0305 19 //
RyoheiHagimoto 0:0e0631af0305 20 // * Redistribution's of source code must retain the above copyright notice,
RyoheiHagimoto 0:0e0631af0305 21 // this list of conditions and the following disclaimer.
RyoheiHagimoto 0:0e0631af0305 22 //
RyoheiHagimoto 0:0e0631af0305 23 // * Redistribution's in binary form must reproduce the above copyright notice,
RyoheiHagimoto 0:0e0631af0305 24 // this list of conditions and the following disclaimer in the documentation
RyoheiHagimoto 0:0e0631af0305 25 // and/or other materials provided with the distribution.
RyoheiHagimoto 0:0e0631af0305 26 //
RyoheiHagimoto 0:0e0631af0305 27 // * The name of the copyright holders may not be used to endorse or promote products
RyoheiHagimoto 0:0e0631af0305 28 // derived from this software without specific prior written permission.
RyoheiHagimoto 0:0e0631af0305 29 //
RyoheiHagimoto 0:0e0631af0305 30 // This software is provided by the copyright holders and contributors "as is" and
RyoheiHagimoto 0:0e0631af0305 31 // any express or implied warranties, including, but not limited to, the implied
RyoheiHagimoto 0:0e0631af0305 32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
RyoheiHagimoto 0:0e0631af0305 33 // In no event shall the Intel Corporation or contributors be liable for any direct,
RyoheiHagimoto 0:0e0631af0305 34 // indirect, incidental, special, exemplary, or consequential damages
RyoheiHagimoto 0:0e0631af0305 35 // (including, but not limited to, procurement of substitute goods or services;
RyoheiHagimoto 0:0e0631af0305 36 // loss of use, data, or profits; or business interruption) however caused
RyoheiHagimoto 0:0e0631af0305 37 // and on any theory of liability, whether in contract, strict liability,
RyoheiHagimoto 0:0e0631af0305 38 // or tort (including negligence or otherwise) arising in any way out of
RyoheiHagimoto 0:0e0631af0305 39 // the use of this software, even if advised of the possibility of such damage.
RyoheiHagimoto 0:0e0631af0305 40 //
RyoheiHagimoto 0:0e0631af0305 41 //M*/
RyoheiHagimoto 0:0e0631af0305 42
RyoheiHagimoto 0:0e0631af0305 43 #ifndef OPENCV_STITCHING_WARPERS_HPP
RyoheiHagimoto 0:0e0631af0305 44 #define OPENCV_STITCHING_WARPERS_HPP
RyoheiHagimoto 0:0e0631af0305 45
RyoheiHagimoto 0:0e0631af0305 46 #include "opencv2/core.hpp"
RyoheiHagimoto 0:0e0631af0305 47 #include "opencv2/core/cuda.hpp"
RyoheiHagimoto 0:0e0631af0305 48 #include "opencv2/imgproc.hpp"
RyoheiHagimoto 0:0e0631af0305 49 #include "opencv2/opencv_modules.hpp"
RyoheiHagimoto 0:0e0631af0305 50
RyoheiHagimoto 0:0e0631af0305 51 namespace cv {
RyoheiHagimoto 0:0e0631af0305 52 namespace detail {
RyoheiHagimoto 0:0e0631af0305 53
RyoheiHagimoto 0:0e0631af0305 54 //! @addtogroup stitching_warp
RyoheiHagimoto 0:0e0631af0305 55 //! @{
RyoheiHagimoto 0:0e0631af0305 56
RyoheiHagimoto 0:0e0631af0305 57 /** @brief Rotation-only model image warper interface.
RyoheiHagimoto 0:0e0631af0305 58 */
RyoheiHagimoto 0:0e0631af0305 59 class CV_EXPORTS RotationWarper
RyoheiHagimoto 0:0e0631af0305 60 {
RyoheiHagimoto 0:0e0631af0305 61 public:
RyoheiHagimoto 0:0e0631af0305 62 virtual ~RotationWarper() {}
RyoheiHagimoto 0:0e0631af0305 63
RyoheiHagimoto 0:0e0631af0305 64 /** @brief Projects the image point.
RyoheiHagimoto 0:0e0631af0305 65
RyoheiHagimoto 0:0e0631af0305 66 @param pt Source point
RyoheiHagimoto 0:0e0631af0305 67 @param K Camera intrinsic parameters
RyoheiHagimoto 0:0e0631af0305 68 @param R Camera rotation matrix
RyoheiHagimoto 0:0e0631af0305 69 @return Projected point
RyoheiHagimoto 0:0e0631af0305 70 */
RyoheiHagimoto 0:0e0631af0305 71 virtual Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) = 0;
RyoheiHagimoto 0:0e0631af0305 72
RyoheiHagimoto 0:0e0631af0305 73 /** @brief Builds the projection maps according to the given camera data.
RyoheiHagimoto 0:0e0631af0305 74
RyoheiHagimoto 0:0e0631af0305 75 @param src_size Source image size
RyoheiHagimoto 0:0e0631af0305 76 @param K Camera intrinsic parameters
RyoheiHagimoto 0:0e0631af0305 77 @param R Camera rotation matrix
RyoheiHagimoto 0:0e0631af0305 78 @param xmap Projection map for the x axis
RyoheiHagimoto 0:0e0631af0305 79 @param ymap Projection map for the y axis
RyoheiHagimoto 0:0e0631af0305 80 @return Projected image minimum bounding box
RyoheiHagimoto 0:0e0631af0305 81 */
RyoheiHagimoto 0:0e0631af0305 82 virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) = 0;
RyoheiHagimoto 0:0e0631af0305 83
RyoheiHagimoto 0:0e0631af0305 84 /** @brief Projects the image.
RyoheiHagimoto 0:0e0631af0305 85
RyoheiHagimoto 0:0e0631af0305 86 @param src Source image
RyoheiHagimoto 0:0e0631af0305 87 @param K Camera intrinsic parameters
RyoheiHagimoto 0:0e0631af0305 88 @param R Camera rotation matrix
RyoheiHagimoto 0:0e0631af0305 89 @param interp_mode Interpolation mode
RyoheiHagimoto 0:0e0631af0305 90 @param border_mode Border extrapolation mode
RyoheiHagimoto 0:0e0631af0305 91 @param dst Projected image
RyoheiHagimoto 0:0e0631af0305 92 @return Project image top-left corner
RyoheiHagimoto 0:0e0631af0305 93 */
RyoheiHagimoto 0:0e0631af0305 94 virtual Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
RyoheiHagimoto 0:0e0631af0305 95 OutputArray dst) = 0;
RyoheiHagimoto 0:0e0631af0305 96
RyoheiHagimoto 0:0e0631af0305 97 /** @brief Projects the image backward.
RyoheiHagimoto 0:0e0631af0305 98
RyoheiHagimoto 0:0e0631af0305 99 @param src Projected image
RyoheiHagimoto 0:0e0631af0305 100 @param K Camera intrinsic parameters
RyoheiHagimoto 0:0e0631af0305 101 @param R Camera rotation matrix
RyoheiHagimoto 0:0e0631af0305 102 @param interp_mode Interpolation mode
RyoheiHagimoto 0:0e0631af0305 103 @param border_mode Border extrapolation mode
RyoheiHagimoto 0:0e0631af0305 104 @param dst_size Backward-projected image size
RyoheiHagimoto 0:0e0631af0305 105 @param dst Backward-projected image
RyoheiHagimoto 0:0e0631af0305 106 */
RyoheiHagimoto 0:0e0631af0305 107 virtual void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
RyoheiHagimoto 0:0e0631af0305 108 Size dst_size, OutputArray dst) = 0;
RyoheiHagimoto 0:0e0631af0305 109
RyoheiHagimoto 0:0e0631af0305 110 /**
RyoheiHagimoto 0:0e0631af0305 111 @param src_size Source image bounding box
RyoheiHagimoto 0:0e0631af0305 112 @param K Camera intrinsic parameters
RyoheiHagimoto 0:0e0631af0305 113 @param R Camera rotation matrix
RyoheiHagimoto 0:0e0631af0305 114 @return Projected image minimum bounding box
RyoheiHagimoto 0:0e0631af0305 115 */
RyoheiHagimoto 0:0e0631af0305 116 virtual Rect warpRoi(Size src_size, InputArray K, InputArray R) = 0;
RyoheiHagimoto 0:0e0631af0305 117
RyoheiHagimoto 0:0e0631af0305 118 virtual float getScale() const { return 1.f; }
RyoheiHagimoto 0:0e0631af0305 119 virtual void setScale(float) {}
RyoheiHagimoto 0:0e0631af0305 120 };
RyoheiHagimoto 0:0e0631af0305 121
RyoheiHagimoto 0:0e0631af0305 122 /** @brief Base class for warping logic implementation.
RyoheiHagimoto 0:0e0631af0305 123 */
RyoheiHagimoto 0:0e0631af0305 124 struct CV_EXPORTS ProjectorBase
RyoheiHagimoto 0:0e0631af0305 125 {
RyoheiHagimoto 0:0e0631af0305 126 void setCameraParams(InputArray K = Mat::eye(3, 3, CV_32F),
RyoheiHagimoto 0:0e0631af0305 127 InputArray R = Mat::eye(3, 3, CV_32F),
RyoheiHagimoto 0:0e0631af0305 128 InputArray T = Mat::zeros(3, 1, CV_32F));
RyoheiHagimoto 0:0e0631af0305 129
RyoheiHagimoto 0:0e0631af0305 130 float scale;
RyoheiHagimoto 0:0e0631af0305 131 float k[9];
RyoheiHagimoto 0:0e0631af0305 132 float rinv[9];
RyoheiHagimoto 0:0e0631af0305 133 float r_kinv[9];
RyoheiHagimoto 0:0e0631af0305 134 float k_rinv[9];
RyoheiHagimoto 0:0e0631af0305 135 float t[3];
RyoheiHagimoto 0:0e0631af0305 136 };
RyoheiHagimoto 0:0e0631af0305 137
RyoheiHagimoto 0:0e0631af0305 138 /** @brief Base class for rotation-based warper using a detail::ProjectorBase_ derived class.
RyoheiHagimoto 0:0e0631af0305 139 */
RyoheiHagimoto 0:0e0631af0305 140 template <class P>
RyoheiHagimoto 0:0e0631af0305 141 class CV_EXPORTS RotationWarperBase : public RotationWarper
RyoheiHagimoto 0:0e0631af0305 142 {
RyoheiHagimoto 0:0e0631af0305 143 public:
RyoheiHagimoto 0:0e0631af0305 144 Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R);
RyoheiHagimoto 0:0e0631af0305 145
RyoheiHagimoto 0:0e0631af0305 146 Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap);
RyoheiHagimoto 0:0e0631af0305 147
RyoheiHagimoto 0:0e0631af0305 148 Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
RyoheiHagimoto 0:0e0631af0305 149 OutputArray dst);
RyoheiHagimoto 0:0e0631af0305 150
RyoheiHagimoto 0:0e0631af0305 151 void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
RyoheiHagimoto 0:0e0631af0305 152 Size dst_size, OutputArray dst);
RyoheiHagimoto 0:0e0631af0305 153
RyoheiHagimoto 0:0e0631af0305 154 Rect warpRoi(Size src_size, InputArray K, InputArray R);
RyoheiHagimoto 0:0e0631af0305 155
RyoheiHagimoto 0:0e0631af0305 156 float getScale() const { return projector_.scale; }
RyoheiHagimoto 0:0e0631af0305 157 void setScale(float val) { projector_.scale = val; }
RyoheiHagimoto 0:0e0631af0305 158
RyoheiHagimoto 0:0e0631af0305 159 protected:
RyoheiHagimoto 0:0e0631af0305 160
RyoheiHagimoto 0:0e0631af0305 161 // Detects ROI of the destination image. It's correct for any projection.
RyoheiHagimoto 0:0e0631af0305 162 virtual void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br);
RyoheiHagimoto 0:0e0631af0305 163
RyoheiHagimoto 0:0e0631af0305 164 // Detects ROI of the destination image by walking over image border.
RyoheiHagimoto 0:0e0631af0305 165 // Correctness for any projection isn't guaranteed.
RyoheiHagimoto 0:0e0631af0305 166 void detectResultRoiByBorder(Size src_size, Point &dst_tl, Point &dst_br);
RyoheiHagimoto 0:0e0631af0305 167
RyoheiHagimoto 0:0e0631af0305 168 P projector_;
RyoheiHagimoto 0:0e0631af0305 169 };
RyoheiHagimoto 0:0e0631af0305 170
RyoheiHagimoto 0:0e0631af0305 171
RyoheiHagimoto 0:0e0631af0305 172 struct CV_EXPORTS PlaneProjector : ProjectorBase
RyoheiHagimoto 0:0e0631af0305 173 {
RyoheiHagimoto 0:0e0631af0305 174 void mapForward(float x, float y, float &u, float &v);
RyoheiHagimoto 0:0e0631af0305 175 void mapBackward(float u, float v, float &x, float &y);
RyoheiHagimoto 0:0e0631af0305 176 };
RyoheiHagimoto 0:0e0631af0305 177
RyoheiHagimoto 0:0e0631af0305 178 /** @brief Warper that maps an image onto the z = 1 plane.
RyoheiHagimoto 0:0e0631af0305 179 */
RyoheiHagimoto 0:0e0631af0305 180 class CV_EXPORTS PlaneWarper : public RotationWarperBase<PlaneProjector>
RyoheiHagimoto 0:0e0631af0305 181 {
RyoheiHagimoto 0:0e0631af0305 182 public:
RyoheiHagimoto 0:0e0631af0305 183 /** @brief Construct an instance of the plane warper class.
RyoheiHagimoto 0:0e0631af0305 184
RyoheiHagimoto 0:0e0631af0305 185 @param scale Projected image scale multiplier
RyoheiHagimoto 0:0e0631af0305 186 */
RyoheiHagimoto 0:0e0631af0305 187 PlaneWarper(float scale = 1.f) { projector_.scale = scale; }
RyoheiHagimoto 0:0e0631af0305 188
RyoheiHagimoto 0:0e0631af0305 189 Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R);
RyoheiHagimoto 0:0e0631af0305 190 Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R, InputArray T);
RyoheiHagimoto 0:0e0631af0305 191
RyoheiHagimoto 0:0e0631af0305 192 virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, OutputArray xmap, OutputArray ymap);
RyoheiHagimoto 0:0e0631af0305 193 Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap);
RyoheiHagimoto 0:0e0631af0305 194
RyoheiHagimoto 0:0e0631af0305 195 Point warp(InputArray src, InputArray K, InputArray R,
RyoheiHagimoto 0:0e0631af0305 196 int interp_mode, int border_mode, OutputArray dst);
RyoheiHagimoto 0:0e0631af0305 197 virtual Point warp(InputArray src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode,
RyoheiHagimoto 0:0e0631af0305 198 OutputArray dst);
RyoheiHagimoto 0:0e0631af0305 199
RyoheiHagimoto 0:0e0631af0305 200 Rect warpRoi(Size src_size, InputArray K, InputArray R);
RyoheiHagimoto 0:0e0631af0305 201 Rect warpRoi(Size src_size, InputArray K, InputArray R, InputArray T);
RyoheiHagimoto 0:0e0631af0305 202
RyoheiHagimoto 0:0e0631af0305 203 protected:
RyoheiHagimoto 0:0e0631af0305 204 void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br);
RyoheiHagimoto 0:0e0631af0305 205 };
RyoheiHagimoto 0:0e0631af0305 206
RyoheiHagimoto 0:0e0631af0305 207
RyoheiHagimoto 0:0e0631af0305 208 /** @brief Affine warper that uses rotations and translations
RyoheiHagimoto 0:0e0631af0305 209
RyoheiHagimoto 0:0e0631af0305 210 Uses affine transformation in homogeneous coordinates to represent both rotation and
RyoheiHagimoto 0:0e0631af0305 211 translation in camera rotation matrix.
RyoheiHagimoto 0:0e0631af0305 212 */
RyoheiHagimoto 0:0e0631af0305 213 class CV_EXPORTS AffineWarper : public PlaneWarper
RyoheiHagimoto 0:0e0631af0305 214 {
RyoheiHagimoto 0:0e0631af0305 215 public:
RyoheiHagimoto 0:0e0631af0305 216 /** @brief Construct an instance of the affine warper class.
RyoheiHagimoto 0:0e0631af0305 217
RyoheiHagimoto 0:0e0631af0305 218 @param scale Projected image scale multiplier
RyoheiHagimoto 0:0e0631af0305 219 */
RyoheiHagimoto 0:0e0631af0305 220 AffineWarper(float scale = 1.f) : PlaneWarper(scale) {}
RyoheiHagimoto 0:0e0631af0305 221
RyoheiHagimoto 0:0e0631af0305 222 Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R);
RyoheiHagimoto 0:0e0631af0305 223 Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap);
RyoheiHagimoto 0:0e0631af0305 224 Point warp(InputArray src, InputArray K, InputArray R,
RyoheiHagimoto 0:0e0631af0305 225 int interp_mode, int border_mode, OutputArray dst);
RyoheiHagimoto 0:0e0631af0305 226 Rect warpRoi(Size src_size, InputArray K, InputArray R);
RyoheiHagimoto 0:0e0631af0305 227
RyoheiHagimoto 0:0e0631af0305 228 protected:
RyoheiHagimoto 0:0e0631af0305 229 /** @brief Extracts rotation and translation matrices from matrix H representing
RyoheiHagimoto 0:0e0631af0305 230 affine transformation in homogeneous coordinates
RyoheiHagimoto 0:0e0631af0305 231 */
RyoheiHagimoto 0:0e0631af0305 232 void getRTfromHomogeneous(InputArray H, Mat &R, Mat &T);
RyoheiHagimoto 0:0e0631af0305 233 };
RyoheiHagimoto 0:0e0631af0305 234
RyoheiHagimoto 0:0e0631af0305 235
RyoheiHagimoto 0:0e0631af0305 236 struct CV_EXPORTS SphericalProjector : ProjectorBase
RyoheiHagimoto 0:0e0631af0305 237 {
RyoheiHagimoto 0:0e0631af0305 238 void mapForward(float x, float y, float &u, float &v);
RyoheiHagimoto 0:0e0631af0305 239 void mapBackward(float u, float v, float &x, float &y);
RyoheiHagimoto 0:0e0631af0305 240 };
RyoheiHagimoto 0:0e0631af0305 241
RyoheiHagimoto 0:0e0631af0305 242
RyoheiHagimoto 0:0e0631af0305 243 /** @brief Warper that maps an image onto the unit sphere located at the origin.
RyoheiHagimoto 0:0e0631af0305 244
RyoheiHagimoto 0:0e0631af0305 245 Projects image onto unit sphere with origin at (0, 0, 0) and radius scale, measured in pixels.
RyoheiHagimoto 0:0e0631af0305 246 A 360° panorama would therefore have a resulting width of 2 * scale * PI pixels.
RyoheiHagimoto 0:0e0631af0305 247 Poles are located at (0, -1, 0) and (0, 1, 0) points.
RyoheiHagimoto 0:0e0631af0305 248 */
RyoheiHagimoto 0:0e0631af0305 249 class CV_EXPORTS SphericalWarper : public RotationWarperBase<SphericalProjector>
RyoheiHagimoto 0:0e0631af0305 250 {
RyoheiHagimoto 0:0e0631af0305 251 public:
RyoheiHagimoto 0:0e0631af0305 252 /** @brief Construct an instance of the spherical warper class.
RyoheiHagimoto 0:0e0631af0305 253
RyoheiHagimoto 0:0e0631af0305 254 @param scale Radius of the projected sphere, in pixels. An image spanning the
RyoheiHagimoto 0:0e0631af0305 255 whole sphere will have a width of 2 * scale * PI pixels.
RyoheiHagimoto 0:0e0631af0305 256 */
RyoheiHagimoto 0:0e0631af0305 257 SphericalWarper(float scale) { projector_.scale = scale; }
RyoheiHagimoto 0:0e0631af0305 258
RyoheiHagimoto 0:0e0631af0305 259 Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap);
RyoheiHagimoto 0:0e0631af0305 260 Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst);
RyoheiHagimoto 0:0e0631af0305 261 protected:
RyoheiHagimoto 0:0e0631af0305 262 void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br);
RyoheiHagimoto 0:0e0631af0305 263 };
RyoheiHagimoto 0:0e0631af0305 264
RyoheiHagimoto 0:0e0631af0305 265
RyoheiHagimoto 0:0e0631af0305 266 struct CV_EXPORTS CylindricalProjector : ProjectorBase
RyoheiHagimoto 0:0e0631af0305 267 {
RyoheiHagimoto 0:0e0631af0305 268 void mapForward(float x, float y, float &u, float &v);
RyoheiHagimoto 0:0e0631af0305 269 void mapBackward(float u, float v, float &x, float &y);
RyoheiHagimoto 0:0e0631af0305 270 };
RyoheiHagimoto 0:0e0631af0305 271
RyoheiHagimoto 0:0e0631af0305 272
RyoheiHagimoto 0:0e0631af0305 273 /** @brief Warper that maps an image onto the x\*x + z\*z = 1 cylinder.
RyoheiHagimoto 0:0e0631af0305 274 */
RyoheiHagimoto 0:0e0631af0305 275 class CV_EXPORTS CylindricalWarper : public RotationWarperBase<CylindricalProjector>
RyoheiHagimoto 0:0e0631af0305 276 {
RyoheiHagimoto 0:0e0631af0305 277 public:
RyoheiHagimoto 0:0e0631af0305 278 /** @brief Construct an instance of the cylindrical warper class.
RyoheiHagimoto 0:0e0631af0305 279
RyoheiHagimoto 0:0e0631af0305 280 @param scale Projected image scale multiplier
RyoheiHagimoto 0:0e0631af0305 281 */
RyoheiHagimoto 0:0e0631af0305 282 CylindricalWarper(float scale) { projector_.scale = scale; }
RyoheiHagimoto 0:0e0631af0305 283
RyoheiHagimoto 0:0e0631af0305 284 Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap);
RyoheiHagimoto 0:0e0631af0305 285 Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst);
RyoheiHagimoto 0:0e0631af0305 286 protected:
RyoheiHagimoto 0:0e0631af0305 287 void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br)
RyoheiHagimoto 0:0e0631af0305 288 {
RyoheiHagimoto 0:0e0631af0305 289 RotationWarperBase<CylindricalProjector>::detectResultRoiByBorder(src_size, dst_tl, dst_br);
RyoheiHagimoto 0:0e0631af0305 290 }
RyoheiHagimoto 0:0e0631af0305 291 };
RyoheiHagimoto 0:0e0631af0305 292
RyoheiHagimoto 0:0e0631af0305 293
RyoheiHagimoto 0:0e0631af0305 294 struct CV_EXPORTS FisheyeProjector : ProjectorBase
RyoheiHagimoto 0:0e0631af0305 295 {
RyoheiHagimoto 0:0e0631af0305 296 void mapForward(float x, float y, float &u, float &v);
RyoheiHagimoto 0:0e0631af0305 297 void mapBackward(float u, float v, float &x, float &y);
RyoheiHagimoto 0:0e0631af0305 298 };
RyoheiHagimoto 0:0e0631af0305 299
RyoheiHagimoto 0:0e0631af0305 300
RyoheiHagimoto 0:0e0631af0305 301 class CV_EXPORTS FisheyeWarper : public RotationWarperBase<FisheyeProjector>
RyoheiHagimoto 0:0e0631af0305 302 {
RyoheiHagimoto 0:0e0631af0305 303 public:
RyoheiHagimoto 0:0e0631af0305 304 FisheyeWarper(float scale) { projector_.scale = scale; }
RyoheiHagimoto 0:0e0631af0305 305 };
RyoheiHagimoto 0:0e0631af0305 306
RyoheiHagimoto 0:0e0631af0305 307
RyoheiHagimoto 0:0e0631af0305 308 struct CV_EXPORTS StereographicProjector : ProjectorBase
RyoheiHagimoto 0:0e0631af0305 309 {
RyoheiHagimoto 0:0e0631af0305 310 void mapForward(float x, float y, float &u, float &v);
RyoheiHagimoto 0:0e0631af0305 311 void mapBackward(float u, float v, float &x, float &y);
RyoheiHagimoto 0:0e0631af0305 312 };
RyoheiHagimoto 0:0e0631af0305 313
RyoheiHagimoto 0:0e0631af0305 314
RyoheiHagimoto 0:0e0631af0305 315 class CV_EXPORTS StereographicWarper : public RotationWarperBase<StereographicProjector>
RyoheiHagimoto 0:0e0631af0305 316 {
RyoheiHagimoto 0:0e0631af0305 317 public:
RyoheiHagimoto 0:0e0631af0305 318 StereographicWarper(float scale) { projector_.scale = scale; }
RyoheiHagimoto 0:0e0631af0305 319 };
RyoheiHagimoto 0:0e0631af0305 320
RyoheiHagimoto 0:0e0631af0305 321
RyoheiHagimoto 0:0e0631af0305 322 struct CV_EXPORTS CompressedRectilinearProjector : ProjectorBase
RyoheiHagimoto 0:0e0631af0305 323 {
RyoheiHagimoto 0:0e0631af0305 324 float a, b;
RyoheiHagimoto 0:0e0631af0305 325
RyoheiHagimoto 0:0e0631af0305 326 void mapForward(float x, float y, float &u, float &v);
RyoheiHagimoto 0:0e0631af0305 327 void mapBackward(float u, float v, float &x, float &y);
RyoheiHagimoto 0:0e0631af0305 328 };
RyoheiHagimoto 0:0e0631af0305 329
RyoheiHagimoto 0:0e0631af0305 330
RyoheiHagimoto 0:0e0631af0305 331 class CV_EXPORTS CompressedRectilinearWarper : public RotationWarperBase<CompressedRectilinearProjector>
RyoheiHagimoto 0:0e0631af0305 332 {
RyoheiHagimoto 0:0e0631af0305 333 public:
RyoheiHagimoto 0:0e0631af0305 334 CompressedRectilinearWarper(float scale, float A = 1, float B = 1)
RyoheiHagimoto 0:0e0631af0305 335 {
RyoheiHagimoto 0:0e0631af0305 336 projector_.a = A;
RyoheiHagimoto 0:0e0631af0305 337 projector_.b = B;
RyoheiHagimoto 0:0e0631af0305 338 projector_.scale = scale;
RyoheiHagimoto 0:0e0631af0305 339 }
RyoheiHagimoto 0:0e0631af0305 340 };
RyoheiHagimoto 0:0e0631af0305 341
RyoheiHagimoto 0:0e0631af0305 342
RyoheiHagimoto 0:0e0631af0305 343 struct CV_EXPORTS CompressedRectilinearPortraitProjector : ProjectorBase
RyoheiHagimoto 0:0e0631af0305 344 {
RyoheiHagimoto 0:0e0631af0305 345 float a, b;
RyoheiHagimoto 0:0e0631af0305 346
RyoheiHagimoto 0:0e0631af0305 347 void mapForward(float x, float y, float &u, float &v);
RyoheiHagimoto 0:0e0631af0305 348 void mapBackward(float u, float v, float &x, float &y);
RyoheiHagimoto 0:0e0631af0305 349 };
RyoheiHagimoto 0:0e0631af0305 350
RyoheiHagimoto 0:0e0631af0305 351
RyoheiHagimoto 0:0e0631af0305 352 class CV_EXPORTS CompressedRectilinearPortraitWarper : public RotationWarperBase<CompressedRectilinearPortraitProjector>
RyoheiHagimoto 0:0e0631af0305 353 {
RyoheiHagimoto 0:0e0631af0305 354 public:
RyoheiHagimoto 0:0e0631af0305 355 CompressedRectilinearPortraitWarper(float scale, float A = 1, float B = 1)
RyoheiHagimoto 0:0e0631af0305 356 {
RyoheiHagimoto 0:0e0631af0305 357 projector_.a = A;
RyoheiHagimoto 0:0e0631af0305 358 projector_.b = B;
RyoheiHagimoto 0:0e0631af0305 359 projector_.scale = scale;
RyoheiHagimoto 0:0e0631af0305 360 }
RyoheiHagimoto 0:0e0631af0305 361 };
RyoheiHagimoto 0:0e0631af0305 362
RyoheiHagimoto 0:0e0631af0305 363
RyoheiHagimoto 0:0e0631af0305 364 struct CV_EXPORTS PaniniProjector : ProjectorBase
RyoheiHagimoto 0:0e0631af0305 365 {
RyoheiHagimoto 0:0e0631af0305 366 float a, b;
RyoheiHagimoto 0:0e0631af0305 367
RyoheiHagimoto 0:0e0631af0305 368 void mapForward(float x, float y, float &u, float &v);
RyoheiHagimoto 0:0e0631af0305 369 void mapBackward(float u, float v, float &x, float &y);
RyoheiHagimoto 0:0e0631af0305 370 };
RyoheiHagimoto 0:0e0631af0305 371
RyoheiHagimoto 0:0e0631af0305 372
RyoheiHagimoto 0:0e0631af0305 373 class CV_EXPORTS PaniniWarper : public RotationWarperBase<PaniniProjector>
RyoheiHagimoto 0:0e0631af0305 374 {
RyoheiHagimoto 0:0e0631af0305 375 public:
RyoheiHagimoto 0:0e0631af0305 376 PaniniWarper(float scale, float A = 1, float B = 1)
RyoheiHagimoto 0:0e0631af0305 377 {
RyoheiHagimoto 0:0e0631af0305 378 projector_.a = A;
RyoheiHagimoto 0:0e0631af0305 379 projector_.b = B;
RyoheiHagimoto 0:0e0631af0305 380 projector_.scale = scale;
RyoheiHagimoto 0:0e0631af0305 381 }
RyoheiHagimoto 0:0e0631af0305 382 };
RyoheiHagimoto 0:0e0631af0305 383
RyoheiHagimoto 0:0e0631af0305 384
RyoheiHagimoto 0:0e0631af0305 385 struct CV_EXPORTS PaniniPortraitProjector : ProjectorBase
RyoheiHagimoto 0:0e0631af0305 386 {
RyoheiHagimoto 0:0e0631af0305 387 float a, b;
RyoheiHagimoto 0:0e0631af0305 388
RyoheiHagimoto 0:0e0631af0305 389 void mapForward(float x, float y, float &u, float &v);
RyoheiHagimoto 0:0e0631af0305 390 void mapBackward(float u, float v, float &x, float &y);
RyoheiHagimoto 0:0e0631af0305 391 };
RyoheiHagimoto 0:0e0631af0305 392
RyoheiHagimoto 0:0e0631af0305 393
RyoheiHagimoto 0:0e0631af0305 394 class CV_EXPORTS PaniniPortraitWarper : public RotationWarperBase<PaniniPortraitProjector>
RyoheiHagimoto 0:0e0631af0305 395 {
RyoheiHagimoto 0:0e0631af0305 396 public:
RyoheiHagimoto 0:0e0631af0305 397 PaniniPortraitWarper(float scale, float A = 1, float B = 1)
RyoheiHagimoto 0:0e0631af0305 398 {
RyoheiHagimoto 0:0e0631af0305 399 projector_.a = A;
RyoheiHagimoto 0:0e0631af0305 400 projector_.b = B;
RyoheiHagimoto 0:0e0631af0305 401 projector_.scale = scale;
RyoheiHagimoto 0:0e0631af0305 402 }
RyoheiHagimoto 0:0e0631af0305 403
RyoheiHagimoto 0:0e0631af0305 404 };
RyoheiHagimoto 0:0e0631af0305 405
RyoheiHagimoto 0:0e0631af0305 406
RyoheiHagimoto 0:0e0631af0305 407 struct CV_EXPORTS MercatorProjector : ProjectorBase
RyoheiHagimoto 0:0e0631af0305 408 {
RyoheiHagimoto 0:0e0631af0305 409 void mapForward(float x, float y, float &u, float &v);
RyoheiHagimoto 0:0e0631af0305 410 void mapBackward(float u, float v, float &x, float &y);
RyoheiHagimoto 0:0e0631af0305 411 };
RyoheiHagimoto 0:0e0631af0305 412
RyoheiHagimoto 0:0e0631af0305 413
RyoheiHagimoto 0:0e0631af0305 414 class CV_EXPORTS MercatorWarper : public RotationWarperBase<MercatorProjector>
RyoheiHagimoto 0:0e0631af0305 415 {
RyoheiHagimoto 0:0e0631af0305 416 public:
RyoheiHagimoto 0:0e0631af0305 417 MercatorWarper(float scale) { projector_.scale = scale; }
RyoheiHagimoto 0:0e0631af0305 418 };
RyoheiHagimoto 0:0e0631af0305 419
RyoheiHagimoto 0:0e0631af0305 420
RyoheiHagimoto 0:0e0631af0305 421 struct CV_EXPORTS TransverseMercatorProjector : ProjectorBase
RyoheiHagimoto 0:0e0631af0305 422 {
RyoheiHagimoto 0:0e0631af0305 423 void mapForward(float x, float y, float &u, float &v);
RyoheiHagimoto 0:0e0631af0305 424 void mapBackward(float u, float v, float &x, float &y);
RyoheiHagimoto 0:0e0631af0305 425 };
RyoheiHagimoto 0:0e0631af0305 426
RyoheiHagimoto 0:0e0631af0305 427
RyoheiHagimoto 0:0e0631af0305 428 class CV_EXPORTS TransverseMercatorWarper : public RotationWarperBase<TransverseMercatorProjector>
RyoheiHagimoto 0:0e0631af0305 429 {
RyoheiHagimoto 0:0e0631af0305 430 public:
RyoheiHagimoto 0:0e0631af0305 431 TransverseMercatorWarper(float scale) { projector_.scale = scale; }
RyoheiHagimoto 0:0e0631af0305 432 };
RyoheiHagimoto 0:0e0631af0305 433
RyoheiHagimoto 0:0e0631af0305 434
RyoheiHagimoto 0:0e0631af0305 435 class CV_EXPORTS PlaneWarperGpu : public PlaneWarper
RyoheiHagimoto 0:0e0631af0305 436 {
RyoheiHagimoto 0:0e0631af0305 437 public:
RyoheiHagimoto 0:0e0631af0305 438 PlaneWarperGpu(float scale = 1.f) : PlaneWarper(scale) {}
RyoheiHagimoto 0:0e0631af0305 439
RyoheiHagimoto 0:0e0631af0305 440 Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap)
RyoheiHagimoto 0:0e0631af0305 441 {
RyoheiHagimoto 0:0e0631af0305 442 Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_);
RyoheiHagimoto 0:0e0631af0305 443 d_xmap_.download(xmap);
RyoheiHagimoto 0:0e0631af0305 444 d_ymap_.download(ymap);
RyoheiHagimoto 0:0e0631af0305 445 return result;
RyoheiHagimoto 0:0e0631af0305 446 }
RyoheiHagimoto 0:0e0631af0305 447
RyoheiHagimoto 0:0e0631af0305 448 Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, OutputArray xmap, OutputArray ymap)
RyoheiHagimoto 0:0e0631af0305 449 {
RyoheiHagimoto 0:0e0631af0305 450 Rect result = buildMaps(src_size, K, R, T, d_xmap_, d_ymap_);
RyoheiHagimoto 0:0e0631af0305 451 d_xmap_.download(xmap);
RyoheiHagimoto 0:0e0631af0305 452 d_ymap_.download(ymap);
RyoheiHagimoto 0:0e0631af0305 453 return result;
RyoheiHagimoto 0:0e0631af0305 454 }
RyoheiHagimoto 0:0e0631af0305 455
RyoheiHagimoto 0:0e0631af0305 456 Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
RyoheiHagimoto 0:0e0631af0305 457 OutputArray dst)
RyoheiHagimoto 0:0e0631af0305 458 {
RyoheiHagimoto 0:0e0631af0305 459 d_src_.upload(src);
RyoheiHagimoto 0:0e0631af0305 460 Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_);
RyoheiHagimoto 0:0e0631af0305 461 d_dst_.download(dst);
RyoheiHagimoto 0:0e0631af0305 462 return result;
RyoheiHagimoto 0:0e0631af0305 463 }
RyoheiHagimoto 0:0e0631af0305 464
RyoheiHagimoto 0:0e0631af0305 465 Point warp(InputArray src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode,
RyoheiHagimoto 0:0e0631af0305 466 OutputArray dst)
RyoheiHagimoto 0:0e0631af0305 467 {
RyoheiHagimoto 0:0e0631af0305 468 d_src_.upload(src);
RyoheiHagimoto 0:0e0631af0305 469 Point result = warp(d_src_, K, R, T, interp_mode, border_mode, d_dst_);
RyoheiHagimoto 0:0e0631af0305 470 d_dst_.download(dst);
RyoheiHagimoto 0:0e0631af0305 471 return result;
RyoheiHagimoto 0:0e0631af0305 472 }
RyoheiHagimoto 0:0e0631af0305 473
RyoheiHagimoto 0:0e0631af0305 474 Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
RyoheiHagimoto 0:0e0631af0305 475
RyoheiHagimoto 0:0e0631af0305 476 Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
RyoheiHagimoto 0:0e0631af0305 477
RyoheiHagimoto 0:0e0631af0305 478 Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode,
RyoheiHagimoto 0:0e0631af0305 479 cuda::GpuMat & dst);
RyoheiHagimoto 0:0e0631af0305 480
RyoheiHagimoto 0:0e0631af0305 481 Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode,
RyoheiHagimoto 0:0e0631af0305 482 cuda::GpuMat & dst);
RyoheiHagimoto 0:0e0631af0305 483
RyoheiHagimoto 0:0e0631af0305 484 private:
RyoheiHagimoto 0:0e0631af0305 485 cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_;
RyoheiHagimoto 0:0e0631af0305 486 };
RyoheiHagimoto 0:0e0631af0305 487
RyoheiHagimoto 0:0e0631af0305 488
RyoheiHagimoto 0:0e0631af0305 489 class CV_EXPORTS SphericalWarperGpu : public SphericalWarper
RyoheiHagimoto 0:0e0631af0305 490 {
RyoheiHagimoto 0:0e0631af0305 491 public:
RyoheiHagimoto 0:0e0631af0305 492 SphericalWarperGpu(float scale) : SphericalWarper(scale) {}
RyoheiHagimoto 0:0e0631af0305 493
RyoheiHagimoto 0:0e0631af0305 494 Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap)
RyoheiHagimoto 0:0e0631af0305 495 {
RyoheiHagimoto 0:0e0631af0305 496 Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_);
RyoheiHagimoto 0:0e0631af0305 497 d_xmap_.download(xmap);
RyoheiHagimoto 0:0e0631af0305 498 d_ymap_.download(ymap);
RyoheiHagimoto 0:0e0631af0305 499 return result;
RyoheiHagimoto 0:0e0631af0305 500 }
RyoheiHagimoto 0:0e0631af0305 501
RyoheiHagimoto 0:0e0631af0305 502 Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
RyoheiHagimoto 0:0e0631af0305 503 OutputArray dst)
RyoheiHagimoto 0:0e0631af0305 504 {
RyoheiHagimoto 0:0e0631af0305 505 d_src_.upload(src);
RyoheiHagimoto 0:0e0631af0305 506 Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_);
RyoheiHagimoto 0:0e0631af0305 507 d_dst_.download(dst);
RyoheiHagimoto 0:0e0631af0305 508 return result;
RyoheiHagimoto 0:0e0631af0305 509 }
RyoheiHagimoto 0:0e0631af0305 510
RyoheiHagimoto 0:0e0631af0305 511 Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
RyoheiHagimoto 0:0e0631af0305 512
RyoheiHagimoto 0:0e0631af0305 513 Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode,
RyoheiHagimoto 0:0e0631af0305 514 cuda::GpuMat & dst);
RyoheiHagimoto 0:0e0631af0305 515
RyoheiHagimoto 0:0e0631af0305 516 private:
RyoheiHagimoto 0:0e0631af0305 517 cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_;
RyoheiHagimoto 0:0e0631af0305 518 };
RyoheiHagimoto 0:0e0631af0305 519
RyoheiHagimoto 0:0e0631af0305 520
RyoheiHagimoto 0:0e0631af0305 521 class CV_EXPORTS CylindricalWarperGpu : public CylindricalWarper
RyoheiHagimoto 0:0e0631af0305 522 {
RyoheiHagimoto 0:0e0631af0305 523 public:
RyoheiHagimoto 0:0e0631af0305 524 CylindricalWarperGpu(float scale) : CylindricalWarper(scale) {}
RyoheiHagimoto 0:0e0631af0305 525
RyoheiHagimoto 0:0e0631af0305 526 Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap)
RyoheiHagimoto 0:0e0631af0305 527 {
RyoheiHagimoto 0:0e0631af0305 528 Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_);
RyoheiHagimoto 0:0e0631af0305 529 d_xmap_.download(xmap);
RyoheiHagimoto 0:0e0631af0305 530 d_ymap_.download(ymap);
RyoheiHagimoto 0:0e0631af0305 531 return result;
RyoheiHagimoto 0:0e0631af0305 532 }
RyoheiHagimoto 0:0e0631af0305 533
RyoheiHagimoto 0:0e0631af0305 534 Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
RyoheiHagimoto 0:0e0631af0305 535 OutputArray dst)
RyoheiHagimoto 0:0e0631af0305 536 {
RyoheiHagimoto 0:0e0631af0305 537 d_src_.upload(src);
RyoheiHagimoto 0:0e0631af0305 538 Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_);
RyoheiHagimoto 0:0e0631af0305 539 d_dst_.download(dst);
RyoheiHagimoto 0:0e0631af0305 540 return result;
RyoheiHagimoto 0:0e0631af0305 541 }
RyoheiHagimoto 0:0e0631af0305 542
RyoheiHagimoto 0:0e0631af0305 543 Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
RyoheiHagimoto 0:0e0631af0305 544
RyoheiHagimoto 0:0e0631af0305 545 Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode,
RyoheiHagimoto 0:0e0631af0305 546 cuda::GpuMat & dst);
RyoheiHagimoto 0:0e0631af0305 547
RyoheiHagimoto 0:0e0631af0305 548 private:
RyoheiHagimoto 0:0e0631af0305 549 cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_;
RyoheiHagimoto 0:0e0631af0305 550 };
RyoheiHagimoto 0:0e0631af0305 551
RyoheiHagimoto 0:0e0631af0305 552
RyoheiHagimoto 0:0e0631af0305 553 struct SphericalPortraitProjector : ProjectorBase
RyoheiHagimoto 0:0e0631af0305 554 {
RyoheiHagimoto 0:0e0631af0305 555 void mapForward(float x, float y, float &u, float &v);
RyoheiHagimoto 0:0e0631af0305 556 void mapBackward(float u, float v, float &x, float &y);
RyoheiHagimoto 0:0e0631af0305 557 };
RyoheiHagimoto 0:0e0631af0305 558
RyoheiHagimoto 0:0e0631af0305 559
RyoheiHagimoto 0:0e0631af0305 560 // Projects image onto unit sphere with origin at (0, 0, 0).
RyoheiHagimoto 0:0e0631af0305 561 // Poles are located NOT at (0, -1, 0) and (0, 1, 0) points, BUT at (1, 0, 0) and (-1, 0, 0) points.
RyoheiHagimoto 0:0e0631af0305 562 class CV_EXPORTS SphericalPortraitWarper : public RotationWarperBase<SphericalPortraitProjector>
RyoheiHagimoto 0:0e0631af0305 563 {
RyoheiHagimoto 0:0e0631af0305 564 public:
RyoheiHagimoto 0:0e0631af0305 565 SphericalPortraitWarper(float scale) { projector_.scale = scale; }
RyoheiHagimoto 0:0e0631af0305 566
RyoheiHagimoto 0:0e0631af0305 567 protected:
RyoheiHagimoto 0:0e0631af0305 568 void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br);
RyoheiHagimoto 0:0e0631af0305 569 };
RyoheiHagimoto 0:0e0631af0305 570
RyoheiHagimoto 0:0e0631af0305 571 struct CylindricalPortraitProjector : ProjectorBase
RyoheiHagimoto 0:0e0631af0305 572 {
RyoheiHagimoto 0:0e0631af0305 573 void mapForward(float x, float y, float &u, float &v);
RyoheiHagimoto 0:0e0631af0305 574 void mapBackward(float u, float v, float &x, float &y);
RyoheiHagimoto 0:0e0631af0305 575 };
RyoheiHagimoto 0:0e0631af0305 576
RyoheiHagimoto 0:0e0631af0305 577
RyoheiHagimoto 0:0e0631af0305 578 class CV_EXPORTS CylindricalPortraitWarper : public RotationWarperBase<CylindricalPortraitProjector>
RyoheiHagimoto 0:0e0631af0305 579 {
RyoheiHagimoto 0:0e0631af0305 580 public:
RyoheiHagimoto 0:0e0631af0305 581 CylindricalPortraitWarper(float scale) { projector_.scale = scale; }
RyoheiHagimoto 0:0e0631af0305 582
RyoheiHagimoto 0:0e0631af0305 583 protected:
RyoheiHagimoto 0:0e0631af0305 584 void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br)
RyoheiHagimoto 0:0e0631af0305 585 {
RyoheiHagimoto 0:0e0631af0305 586 RotationWarperBase<CylindricalPortraitProjector>::detectResultRoiByBorder(src_size, dst_tl, dst_br);
RyoheiHagimoto 0:0e0631af0305 587 }
RyoheiHagimoto 0:0e0631af0305 588 };
RyoheiHagimoto 0:0e0631af0305 589
RyoheiHagimoto 0:0e0631af0305 590 struct PlanePortraitProjector : ProjectorBase
RyoheiHagimoto 0:0e0631af0305 591 {
RyoheiHagimoto 0:0e0631af0305 592 void mapForward(float x, float y, float &u, float &v);
RyoheiHagimoto 0:0e0631af0305 593 void mapBackward(float u, float v, float &x, float &y);
RyoheiHagimoto 0:0e0631af0305 594 };
RyoheiHagimoto 0:0e0631af0305 595
RyoheiHagimoto 0:0e0631af0305 596
RyoheiHagimoto 0:0e0631af0305 597 class CV_EXPORTS PlanePortraitWarper : public RotationWarperBase<PlanePortraitProjector>
RyoheiHagimoto 0:0e0631af0305 598 {
RyoheiHagimoto 0:0e0631af0305 599 public:
RyoheiHagimoto 0:0e0631af0305 600 PlanePortraitWarper(float scale) { projector_.scale = scale; }
RyoheiHagimoto 0:0e0631af0305 601
RyoheiHagimoto 0:0e0631af0305 602 protected:
RyoheiHagimoto 0:0e0631af0305 603 void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br)
RyoheiHagimoto 0:0e0631af0305 604 {
RyoheiHagimoto 0:0e0631af0305 605 RotationWarperBase<PlanePortraitProjector>::detectResultRoiByBorder(src_size, dst_tl, dst_br);
RyoheiHagimoto 0:0e0631af0305 606 }
RyoheiHagimoto 0:0e0631af0305 607 };
RyoheiHagimoto 0:0e0631af0305 608
RyoheiHagimoto 0:0e0631af0305 609 //! @} stitching_warp
RyoheiHagimoto 0:0e0631af0305 610
RyoheiHagimoto 0:0e0631af0305 611 } // namespace detail
RyoheiHagimoto 0:0e0631af0305 612 } // namespace cv
RyoheiHagimoto 0:0e0631af0305 613
RyoheiHagimoto 0:0e0631af0305 614 #include "warpers_inl.hpp"
RyoheiHagimoto 0:0e0631af0305 615
RyoheiHagimoto 0:0e0631af0305 616 #endif // OPENCV_STITCHING_WARPERS_HPP