github.com/kaydxh/golang@v0.0.131/pkg/gocv/cgo/third_path/opencv4/include/opencv2/stitching/detail/warpers.hpp (about) 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_WARPERS_HPP 44 #define OPENCV_STITCHING_WARPERS_HPP 45 46 #include "opencv2/core.hpp" 47 #include "opencv2/core/cuda.hpp" 48 #include "opencv2/imgproc.hpp" 49 #include "opencv2/opencv_modules.hpp" 50 51 namespace cv { 52 namespace detail { 53 54 //! @addtogroup stitching_warp 55 //! @{ 56 57 /** @brief Rotation-only model image warper interface. 58 */ 59 class CV_EXPORTS RotationWarper 60 { 61 public: 62 virtual ~RotationWarper() {} 63 64 /** @brief Projects the image point. 65 66 @param pt Source point 67 @param K Camera intrinsic parameters 68 @param R Camera rotation matrix 69 @return Projected point 70 */ 71 virtual Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) = 0; 72 73 /** @brief Projects the image point backward. 74 75 @param pt Projected point 76 @param K Camera intrinsic parameters 77 @param R Camera rotation matrix 78 @return Backward-projected point 79 */ 80 #if CV_VERSION_MAJOR == 4 81 virtual Point2f warpPointBackward(const Point2f& pt, InputArray K, InputArray R) 82 { 83 CV_UNUSED(pt); CV_UNUSED(K); CV_UNUSED(R); 84 CV_Error(Error::StsNotImplemented, ""); 85 } 86 #else 87 virtual Point2f warpPointBackward(const Point2f& pt, InputArray K, InputArray R) = 0; 88 #endif 89 90 /** @brief Builds the projection maps according to the given camera data. 91 92 @param src_size Source image size 93 @param K Camera intrinsic parameters 94 @param R Camera rotation matrix 95 @param xmap Projection map for the x axis 96 @param ymap Projection map for the y axis 97 @return Projected image minimum bounding box 98 */ 99 virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) = 0; 100 101 /** @brief Projects the image. 102 103 @param src Source image 104 @param K Camera intrinsic parameters 105 @param R Camera rotation matrix 106 @param interp_mode Interpolation mode 107 @param border_mode Border extrapolation mode 108 @param dst Projected image 109 @return Project image top-left corner 110 */ 111 virtual Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, 112 CV_OUT OutputArray dst) = 0; 113 114 /** @brief Projects the image backward. 115 116 @param src Projected image 117 @param K Camera intrinsic parameters 118 @param R Camera rotation matrix 119 @param interp_mode Interpolation mode 120 @param border_mode Border extrapolation mode 121 @param dst_size Backward-projected image size 122 @param dst Backward-projected image 123 */ 124 virtual void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, 125 Size dst_size, CV_OUT OutputArray dst) = 0; 126 127 /** 128 @param src_size Source image bounding box 129 @param K Camera intrinsic parameters 130 @param R Camera rotation matrix 131 @return Projected image minimum bounding box 132 */ 133 virtual Rect warpRoi(Size src_size, InputArray K, InputArray R) = 0; 134 135 virtual float getScale() const { return 1.f; } 136 virtual void setScale(float) {} 137 }; 138 139 /** @brief Base class for warping logic implementation. 140 */ 141 struct CV_EXPORTS_W_SIMPLE ProjectorBase 142 { 143 void setCameraParams(InputArray K = Mat::eye(3, 3, CV_32F), 144 InputArray R = Mat::eye(3, 3, CV_32F), 145 InputArray T = Mat::zeros(3, 1, CV_32F)); 146 147 float scale; 148 float k[9]; 149 float rinv[9]; 150 float r_kinv[9]; 151 float k_rinv[9]; 152 float t[3]; 153 }; 154 155 /** @brief Base class for rotation-based warper using a detail::ProjectorBase_ derived class. 156 */ 157 template <class P> 158 class CV_EXPORTS_TEMPLATE RotationWarperBase : public RotationWarper 159 { 160 public: 161 Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) CV_OVERRIDE; 162 163 Point2f warpPointBackward(const Point2f &pt, InputArray K, InputArray R) CV_OVERRIDE; 164 165 Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE; 166 167 Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, 168 OutputArray dst) CV_OVERRIDE; 169 170 void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, 171 Size dst_size, OutputArray dst) CV_OVERRIDE; 172 173 Rect warpRoi(Size src_size, InputArray K, InputArray R) CV_OVERRIDE; 174 175 float getScale() const CV_OVERRIDE{ return projector_.scale; } 176 void setScale(float val) CV_OVERRIDE { projector_.scale = val; } 177 178 protected: 179 180 // Detects ROI of the destination image. It's correct for any projection. 181 virtual void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br); 182 183 // Detects ROI of the destination image by walking over image border. 184 // Correctness for any projection isn't guaranteed. 185 void detectResultRoiByBorder(Size src_size, Point &dst_tl, Point &dst_br); 186 187 P projector_; 188 }; 189 190 191 struct CV_EXPORTS PlaneProjector : ProjectorBase 192 { 193 void mapForward(float x, float y, float &u, float &v); 194 void mapBackward(float u, float v, float &x, float &y); 195 }; 196 197 /** @brief Warper that maps an image onto the z = 1 plane. 198 */ 199 class CV_EXPORTS PlaneWarper : public RotationWarperBase<PlaneProjector> 200 { 201 public: 202 /** @brief Construct an instance of the plane warper class. 203 204 @param scale Projected image scale multiplier 205 */ 206 PlaneWarper(float scale = 1.f) { projector_.scale = scale; } 207 208 Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) CV_OVERRIDE; 209 Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R, InputArray T); 210 211 Point2f warpPointBackward(const Point2f& pt, InputArray K, InputArray R) CV_OVERRIDE; 212 Point2f warpPointBackward(const Point2f& pt, InputArray K, InputArray R, InputArray T); 213 214 virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, CV_OUT OutputArray xmap, CV_OUT OutputArray ymap); 215 Rect buildMaps(Size src_size, InputArray K, InputArray R, CV_OUT OutputArray xmap, CV_OUT OutputArray ymap) CV_OVERRIDE; 216 217 Point warp(InputArray src, InputArray K, InputArray R, 218 int interp_mode, int border_mode, CV_OUT OutputArray dst) CV_OVERRIDE; 219 virtual Point warp(InputArray src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode, 220 CV_OUT OutputArray dst); 221 222 Rect warpRoi(Size src_size, InputArray K, InputArray R) CV_OVERRIDE; 223 Rect warpRoi(Size src_size, InputArray K, InputArray R, InputArray T); 224 225 protected: 226 void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE; 227 }; 228 229 230 /** @brief Affine warper that uses rotations and translations 231 232 Uses affine transformation in homogeneous coordinates to represent both rotation and 233 translation in camera rotation matrix. 234 */ 235 class CV_EXPORTS AffineWarper : public PlaneWarper 236 { 237 public: 238 /** @brief Construct an instance of the affine warper class. 239 240 @param scale Projected image scale multiplier 241 */ 242 AffineWarper(float scale = 1.f) : PlaneWarper(scale) {} 243 244 /** @brief Projects the image point. 245 246 @param pt Source point 247 @param K Camera intrinsic parameters 248 @param H Camera extrinsic parameters 249 @return Projected point 250 */ 251 Point2f warpPoint(const Point2f &pt, InputArray K, InputArray H) CV_OVERRIDE; 252 253 /** @brief Projects the image point backward. 254 255 @param pt Projected point 256 @param K Camera intrinsic parameters 257 @param H Camera extrinsic parameters 258 @return Backward-projected point 259 */ 260 Point2f warpPointBackward(const Point2f &pt, InputArray K, InputArray H) CV_OVERRIDE; 261 262 /** @brief Builds the projection maps according to the given camera data. 263 264 @param src_size Source image size 265 @param K Camera intrinsic parameters 266 @param H Camera extrinsic parameters 267 @param xmap Projection map for the x axis 268 @param ymap Projection map for the y axis 269 @return Projected image minimum bounding box 270 */ 271 Rect buildMaps(Size src_size, InputArray K, InputArray H, OutputArray xmap, OutputArray ymap) CV_OVERRIDE; 272 273 /** @brief Projects the image. 274 275 @param src Source image 276 @param K Camera intrinsic parameters 277 @param H Camera extrinsic parameters 278 @param interp_mode Interpolation mode 279 @param border_mode Border extrapolation mode 280 @param dst Projected image 281 @return Project image top-left corner 282 */ 283 Point warp(InputArray src, InputArray K, InputArray H, 284 int interp_mode, int border_mode, OutputArray dst) CV_OVERRIDE; 285 286 /** 287 @param src_size Source image bounding box 288 @param K Camera intrinsic parameters 289 @param H Camera extrinsic parameters 290 @return Projected image minimum bounding box 291 */ 292 Rect warpRoi(Size src_size, InputArray K, InputArray H) CV_OVERRIDE; 293 294 protected: 295 /** @brief Extracts rotation and translation matrices from matrix H representing 296 affine transformation in homogeneous coordinates 297 */ 298 void getRTfromHomogeneous(InputArray H, Mat &R, Mat &T); 299 }; 300 301 302 struct CV_EXPORTS_W_SIMPLE SphericalProjector : ProjectorBase 303 { 304 CV_WRAP void mapForward(float x, float y, float &u, float &v); 305 CV_WRAP void mapBackward(float u, float v, float &x, float &y); 306 }; 307 308 309 /** @brief Warper that maps an image onto the unit sphere located at the origin. 310 311 Projects image onto unit sphere with origin at (0, 0, 0) and radius scale, measured in pixels. 312 A 360 panorama would therefore have a resulting width of 2 * scale * PI pixels. 313 Poles are located at (0, -1, 0) and (0, 1, 0) points. 314 */ 315 class CV_EXPORTS SphericalWarper : public RotationWarperBase<SphericalProjector> 316 { 317 public: 318 /** @brief Construct an instance of the spherical warper class. 319 320 @param scale Radius of the projected sphere, in pixels. An image spanning the 321 whole sphere will have a width of 2 * scale * PI pixels. 322 */ 323 SphericalWarper(float scale) { projector_.scale = scale; } 324 325 Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE; 326 Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst) CV_OVERRIDE; 327 protected: 328 void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE; 329 }; 330 331 332 struct CV_EXPORTS CylindricalProjector : ProjectorBase 333 { 334 void mapForward(float x, float y, float &u, float &v); 335 void mapBackward(float u, float v, float &x, float &y); 336 }; 337 338 339 /** @brief Warper that maps an image onto the x\*x + z\*z = 1 cylinder. 340 */ 341 class CV_EXPORTS CylindricalWarper : public RotationWarperBase<CylindricalProjector> 342 { 343 public: 344 /** @brief Construct an instance of the cylindrical warper class. 345 346 @param scale Projected image scale multiplier 347 */ 348 CylindricalWarper(float scale) { projector_.scale = scale; } 349 350 Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE; 351 Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst) CV_OVERRIDE; 352 protected: 353 void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE 354 { 355 RotationWarperBase<CylindricalProjector>::detectResultRoiByBorder(src_size, dst_tl, dst_br); 356 } 357 }; 358 359 360 struct CV_EXPORTS FisheyeProjector : ProjectorBase 361 { 362 void mapForward(float x, float y, float &u, float &v); 363 void mapBackward(float u, float v, float &x, float &y); 364 }; 365 366 367 class CV_EXPORTS FisheyeWarper : public RotationWarperBase<FisheyeProjector> 368 { 369 public: 370 FisheyeWarper(float scale) { projector_.scale = scale; } 371 }; 372 373 374 struct CV_EXPORTS StereographicProjector : ProjectorBase 375 { 376 void mapForward(float x, float y, float &u, float &v); 377 void mapBackward(float u, float v, float &x, float &y); 378 }; 379 380 381 class CV_EXPORTS StereographicWarper : public RotationWarperBase<StereographicProjector> 382 { 383 public: 384 StereographicWarper(float scale) { projector_.scale = scale; } 385 }; 386 387 388 struct CV_EXPORTS CompressedRectilinearProjector : ProjectorBase 389 { 390 float a, b; 391 392 void mapForward(float x, float y, float &u, float &v); 393 void mapBackward(float u, float v, float &x, float &y); 394 }; 395 396 397 class CV_EXPORTS CompressedRectilinearWarper : public RotationWarperBase<CompressedRectilinearProjector> 398 { 399 public: 400 CompressedRectilinearWarper(float scale, float A = 1, float B = 1) 401 { 402 projector_.a = A; 403 projector_.b = B; 404 projector_.scale = scale; 405 } 406 }; 407 408 409 struct CV_EXPORTS CompressedRectilinearPortraitProjector : ProjectorBase 410 { 411 float a, b; 412 413 void mapForward(float x, float y, float &u, float &v); 414 void mapBackward(float u, float v, float &x, float &y); 415 }; 416 417 418 class CV_EXPORTS CompressedRectilinearPortraitWarper : public RotationWarperBase<CompressedRectilinearPortraitProjector> 419 { 420 public: 421 CompressedRectilinearPortraitWarper(float scale, float A = 1, float B = 1) 422 { 423 projector_.a = A; 424 projector_.b = B; 425 projector_.scale = scale; 426 } 427 }; 428 429 430 struct CV_EXPORTS PaniniProjector : ProjectorBase 431 { 432 float a, b; 433 434 void mapForward(float x, float y, float &u, float &v); 435 void mapBackward(float u, float v, float &x, float &y); 436 }; 437 438 439 class CV_EXPORTS PaniniWarper : public RotationWarperBase<PaniniProjector> 440 { 441 public: 442 PaniniWarper(float scale, float A = 1, float B = 1) 443 { 444 projector_.a = A; 445 projector_.b = B; 446 projector_.scale = scale; 447 } 448 }; 449 450 451 struct CV_EXPORTS PaniniPortraitProjector : ProjectorBase 452 { 453 float a, b; 454 455 void mapForward(float x, float y, float &u, float &v); 456 void mapBackward(float u, float v, float &x, float &y); 457 }; 458 459 460 class CV_EXPORTS PaniniPortraitWarper : public RotationWarperBase<PaniniPortraitProjector> 461 { 462 public: 463 PaniniPortraitWarper(float scale, float A = 1, float B = 1) 464 { 465 projector_.a = A; 466 projector_.b = B; 467 projector_.scale = scale; 468 } 469 470 }; 471 472 473 struct CV_EXPORTS MercatorProjector : ProjectorBase 474 { 475 void mapForward(float x, float y, float &u, float &v); 476 void mapBackward(float u, float v, float &x, float &y); 477 }; 478 479 480 class CV_EXPORTS MercatorWarper : public RotationWarperBase<MercatorProjector> 481 { 482 public: 483 MercatorWarper(float scale) { projector_.scale = scale; } 484 }; 485 486 487 struct CV_EXPORTS TransverseMercatorProjector : ProjectorBase 488 { 489 void mapForward(float x, float y, float &u, float &v); 490 void mapBackward(float u, float v, float &x, float &y); 491 }; 492 493 494 class CV_EXPORTS TransverseMercatorWarper : public RotationWarperBase<TransverseMercatorProjector> 495 { 496 public: 497 TransverseMercatorWarper(float scale) { projector_.scale = scale; } 498 }; 499 500 501 class CV_EXPORTS PlaneWarperGpu : public PlaneWarper 502 { 503 public: 504 PlaneWarperGpu(float scale = 1.f) : PlaneWarper(scale) {} 505 506 Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE 507 { 508 Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_); 509 d_xmap_.download(xmap); 510 d_ymap_.download(ymap); 511 return result; 512 } 513 514 Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, OutputArray xmap, OutputArray ymap) CV_OVERRIDE 515 { 516 Rect result = buildMaps(src_size, K, R, T, d_xmap_, d_ymap_); 517 d_xmap_.download(xmap); 518 d_ymap_.download(ymap); 519 return result; 520 } 521 522 Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, 523 OutputArray dst) CV_OVERRIDE 524 { 525 d_src_.upload(src); 526 Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_); 527 d_dst_.download(dst); 528 return result; 529 } 530 531 Point warp(InputArray src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode, 532 OutputArray dst) CV_OVERRIDE 533 { 534 d_src_.upload(src); 535 Point result = warp(d_src_, K, R, T, interp_mode, border_mode, d_dst_); 536 d_dst_.download(dst); 537 return result; 538 } 539 540 Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap); 541 542 Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, cuda::GpuMat & xmap, cuda::GpuMat & ymap); 543 544 Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode, 545 cuda::GpuMat & dst); 546 547 Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode, 548 cuda::GpuMat & dst); 549 550 private: 551 cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_; 552 }; 553 554 555 class CV_EXPORTS SphericalWarperGpu : public SphericalWarper 556 { 557 public: 558 SphericalWarperGpu(float scale) : SphericalWarper(scale) {} 559 560 Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE 561 { 562 Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_); 563 d_xmap_.download(xmap); 564 d_ymap_.download(ymap); 565 return result; 566 } 567 568 Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, 569 OutputArray dst) CV_OVERRIDE 570 { 571 d_src_.upload(src); 572 Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_); 573 d_dst_.download(dst); 574 return result; 575 } 576 577 Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap); 578 579 Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode, 580 cuda::GpuMat & dst); 581 582 private: 583 cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_; 584 }; 585 586 587 class CV_EXPORTS CylindricalWarperGpu : public CylindricalWarper 588 { 589 public: 590 CylindricalWarperGpu(float scale) : CylindricalWarper(scale) {} 591 592 Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE 593 { 594 Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_); 595 d_xmap_.download(xmap); 596 d_ymap_.download(ymap); 597 return result; 598 } 599 600 Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, 601 OutputArray dst) CV_OVERRIDE 602 { 603 d_src_.upload(src); 604 Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_); 605 d_dst_.download(dst); 606 return result; 607 } 608 609 Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap); 610 611 Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode, 612 cuda::GpuMat & dst); 613 614 private: 615 cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_; 616 }; 617 618 619 struct CV_EXPORTS SphericalPortraitProjector : ProjectorBase 620 { 621 void mapForward(float x, float y, float &u, float &v); 622 void mapBackward(float u, float v, float &x, float &y); 623 }; 624 625 626 // Projects image onto unit sphere with origin at (0, 0, 0). 627 // Poles are located NOT at (0, -1, 0) and (0, 1, 0) points, BUT at (1, 0, 0) and (-1, 0, 0) points. 628 class CV_EXPORTS SphericalPortraitWarper : public RotationWarperBase<SphericalPortraitProjector> 629 { 630 public: 631 SphericalPortraitWarper(float scale) { projector_.scale = scale; } 632 633 protected: 634 void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE; 635 }; 636 637 struct CV_EXPORTS CylindricalPortraitProjector : ProjectorBase 638 { 639 void mapForward(float x, float y, float &u, float &v); 640 void mapBackward(float u, float v, float &x, float &y); 641 }; 642 643 644 class CV_EXPORTS CylindricalPortraitWarper : public RotationWarperBase<CylindricalPortraitProjector> 645 { 646 public: 647 CylindricalPortraitWarper(float scale) { projector_.scale = scale; } 648 649 protected: 650 void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE 651 { 652 RotationWarperBase<CylindricalPortraitProjector>::detectResultRoiByBorder(src_size, dst_tl, dst_br); 653 } 654 }; 655 656 struct CV_EXPORTS PlanePortraitProjector : ProjectorBase 657 { 658 void mapForward(float x, float y, float &u, float &v); 659 void mapBackward(float u, float v, float &x, float &y); 660 }; 661 662 663 class CV_EXPORTS PlanePortraitWarper : public RotationWarperBase<PlanePortraitProjector> 664 { 665 public: 666 PlanePortraitWarper(float scale) { projector_.scale = scale; } 667 668 protected: 669 void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE 670 { 671 RotationWarperBase<PlanePortraitProjector>::detectResultRoiByBorder(src_size, dst_tl, dst_br); 672 } 673 }; 674 675 //! @} stitching_warp 676 677 } // namespace detail 678 } // namespace cv 679 680 #include "warpers_inl.hpp" 681 682 #endif // OPENCV_STITCHING_WARPERS_HPP