43#ifndef OPENCV_STITCHING_WARPERS_HPP
44#define OPENCV_STITCHING_WARPERS_HPP
46#include "opencv2/core.hpp"
47#include "opencv2/core/cuda.hpp"
48#include "opencv2/imgproc.hpp"
49#include "opencv2/opencv_modules.hpp"
80#if CV_VERSION_MAJOR == 4
81 virtual Point2f warpPointBackward(
const Point2f& pt, InputArray K, InputArray R)
83 CV_UNUSED(pt); CV_UNUSED(K); CV_UNUSED(R);
84 CV_Error(Error::StsNotImplemented,
"");
111 virtual Point warp(InputArray src, InputArray K, InputArray R,
int interp_mode,
int border_mode,
124 virtual void warpBackward(InputArray src, InputArray K, InputArray R,
int interp_mode,
int border_mode,
135 virtual float getScale()
const {
return 1.f; }
136 virtual void setScale(
float) {}
143 void setCameraParams(InputArray K =
Mat::eye(3, 3, CV_32F),
144 InputArray R =
Mat::eye(3, 3, CV_32F),
167 Point warp(InputArray src, InputArray K, InputArray R,
int interp_mode,
int border_mode,
170 void warpBackward(InputArray src, InputArray K, InputArray R,
int interp_mode,
int border_mode,
175 float getScale() const CV_OVERRIDE{
return projector_.scale; }
176 void setScale(
float val) CV_OVERRIDE { projector_.scale = val; }
181 virtual void detectResultRoi(
Size src_size,
Point &dst_tl,
Point &dst_br);
185 void detectResultRoiByBorder(
Size src_size,
Point &dst_tl,
Point &dst_br);
193 void mapForward(
float x,
float y,
float &u,
float &v);
194 void mapBackward(
float u,
float v,
float &x,
float &y);
209 Point2f warpPoint(
const Point2f &pt, InputArray K, InputArray R, InputArray T);
212 Point2f warpPointBackward(
const Point2f& pt, InputArray K, InputArray R, InputArray T);
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,
223 Rect warpRoi(
Size src_size, InputArray K, InputArray R, InputArray T);
226 void detectResultRoi(
Size src_size,
Point &dst_tl,
Point &dst_br) CV_OVERRIDE;
284 int interp_mode,
int border_mode,
OutputArray dst) CV_OVERRIDE;
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);
326 Point warp(InputArray src, InputArray K, InputArray R,
int interp_mode,
int border_mode,
OutputArray dst) CV_OVERRIDE;
328 void detectResultRoi(
Size src_size,
Point &dst_tl,
Point &dst_br) CV_OVERRIDE;
334 void mapForward(
float x,
float y,
float &u,
float &v);
335 void mapBackward(
float u,
float v,
float &x,
float &y);
351 Point warp(InputArray src, InputArray K, InputArray R,
int interp_mode,
int border_mode,
OutputArray dst) CV_OVERRIDE;
353 void detectResultRoi(
Size src_size,
Point &dst_tl,
Point &dst_br) CV_OVERRIDE
362 void mapForward(
float x,
float y,
float &u,
float &v);
363 void mapBackward(
float u,
float v,
float &x,
float &y);
376 void mapForward(
float x,
float y,
float &u,
float &v);
377 void mapBackward(
float u,
float v,
float &x,
float &y);
392 void mapForward(
float x,
float y,
float &u,
float &v);
393 void mapBackward(
float u,
float v,
float &x,
float &y);
404 projector_.scale = scale;
413 void mapForward(
float x,
float y,
float &u,
float &v);
414 void mapBackward(
float u,
float v,
float &x,
float &y);
425 projector_.scale = scale;
434 void mapForward(
float x,
float y,
float &u,
float &v);
435 void mapBackward(
float u,
float v,
float &x,
float &y);
446 projector_.scale = scale;
455 void mapForward(
float x,
float y,
float &u,
float &v);
456 void mapBackward(
float u,
float v,
float &x,
float &y);
467 projector_.scale = scale;
475 void mapForward(
float x,
float y,
float &u,
float &v);
476 void mapBackward(
float u,
float v,
float &x,
float &y);
489 void mapForward(
float x,
float y,
float &u,
float &v);
490 void mapBackward(
float u,
float v,
float &x,
float &y);
508 Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_);
509 d_xmap_.download(xmap);
510 d_ymap_.download(ymap);
516 Rect result = buildMaps(src_size, K, R, T, d_xmap_, d_ymap_);
517 d_xmap_.download(xmap);
518 d_ymap_.download(ymap);
522 Point warp(InputArray src, InputArray K, InputArray R,
int interp_mode,
int border_mode,
526 Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_);
527 d_dst_.download(dst);
531 Point warp(InputArray src, InputArray K, InputArray R, InputArray T,
int interp_mode,
int border_mode,
532 OutputArray dst) CV_OVERRIDE
535 Point result = warp(d_src_, K, R, T, interp_mode, border_mode, d_dst_);
536 d_dst_.download(dst);
540 Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
542 Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
544 Point warp(
const cuda::GpuMat & src, InputArray K, InputArray R,
int interp_mode,
int border_mode,
547 Point warp(
const cuda::GpuMat & src, InputArray K, InputArray R, InputArray T,
int interp_mode,
int border_mode,
551 cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_;
562 Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_);
563 d_xmap_.download(xmap);
564 d_ymap_.download(ymap);
568 Point warp(InputArray src, InputArray K, InputArray R,
int interp_mode,
int border_mode,
572 Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_);
573 d_dst_.download(dst);
579 Point warp(
const cuda::GpuMat & src, InputArray K, InputArray R,
int interp_mode,
int border_mode,
594 Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_);
595 d_xmap_.download(xmap);
596 d_ymap_.download(ymap);
600 Point warp(InputArray src, InputArray K, InputArray R,
int interp_mode,
int border_mode,
604 Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_);
605 d_dst_.download(dst);
611 Point warp(
const cuda::GpuMat & src, InputArray K, InputArray R,
int interp_mode,
int border_mode,
621 void mapForward(
float x,
float y,
float &u,
float &v);
622 void mapBackward(
float u,
float v,
float &x,
float &y);
634 void detectResultRoi(
Size src_size,
Point &dst_tl,
Point &dst_br) CV_OVERRIDE;
639 void mapForward(
float x,
float y,
float &u,
float &v);
640 void mapBackward(
float u,
float v,
float &x,
float &y);
650 void detectResultRoi(
Size src_size,
Point &dst_tl,
Point &dst_br) CV_OVERRIDE
658 void mapForward(
float x,
float y,
float &u,
float &v);
659 void mapBackward(
float u,
float v,
float &x,
float &y);
669 void detectResultRoi(
Size src_size,
Point &dst_tl,
Point &dst_br) CV_OVERRIDE
680#include "warpers_inl.hpp"
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition: mat.hpp:295
n-dimensional dense array class
Definition: mat.hpp:802
static MatExpr zeros(int rows, int cols, int type)
Returns a zero array of the specified size and type.
static MatExpr eye(int rows, int cols, int type)
Returns an identity matrix of the specified size and type.
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
Base storage class for GPU memory with reference counting.
Definition: core/cuda.hpp:106
Affine warper that uses rotations and translations
Definition: detail/warpers.hpp:236
Point2f warpPointBackward(const Point2f &pt, InputArray K, InputArray H) CV_OVERRIDE
Projects the image point backward.
Point2f warpPoint(const Point2f &pt, InputArray K, InputArray H) CV_OVERRIDE
Projects the image point.
Rect buildMaps(Size src_size, InputArray K, InputArray H, OutputArray xmap, OutputArray ymap) CV_OVERRIDE
Builds the projection maps according to the given camera data.
AffineWarper(float scale=1.f)
Construct an instance of the affine warper class.
Definition: detail/warpers.hpp:242
void getRTfromHomogeneous(InputArray H, Mat &R, Mat &T)
Extracts rotation and translation matrices from matrix H representing affine transformation in homoge...
Point warp(InputArray src, InputArray K, InputArray H, int interp_mode, int border_mode, OutputArray dst) CV_OVERRIDE
Projects the image.
Rect warpRoi(Size src_size, InputArray K, InputArray H) CV_OVERRIDE
Definition: detail/warpers.hpp:419
Definition: detail/warpers.hpp:398
Definition: detail/warpers.hpp:645
Definition: detail/warpers.hpp:588
Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE
Builds the projection maps according to the given camera data.
Definition: detail/warpers.hpp:592
Warper that maps an image onto the x*x + z*z = 1 cylinder.
Definition: detail/warpers.hpp:342
Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE
Builds the projection maps according to the given camera data.
CylindricalWarper(float scale)
Construct an instance of the cylindrical warper class.
Definition: detail/warpers.hpp:348
Definition: detail/warpers.hpp:368
Definition: detail/warpers.hpp:481
Definition: detail/warpers.hpp:461
Definition: detail/warpers.hpp:440
Definition: detail/warpers.hpp:664
Definition: detail/warpers.hpp:502
Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE
Builds the projection maps according to the given camera data.
Definition: detail/warpers.hpp:506
Warper that maps an image onto the z = 1 plane.
Definition: detail/warpers.hpp:200
Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) CV_OVERRIDE
Projects the image point.
Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, CV_OUT OutputArray dst) CV_OVERRIDE
Projects the image.
Rect warpRoi(Size src_size, InputArray K, InputArray R) CV_OVERRIDE
PlaneWarper(float scale=1.f)
Construct an instance of the plane warper class.
Definition: detail/warpers.hpp:206
Point2f warpPointBackward(const Point2f &pt, InputArray K, InputArray R) CV_OVERRIDE
Projects the image point backward.
Base class for rotation-based warper using a detail::ProjectorBase_ derived class.
Definition: detail/warpers.hpp:159
Point2f warpPointBackward(const Point2f &pt, InputArray K, InputArray R) CV_OVERRIDE
Projects the image point backward.
Rect warpRoi(Size src_size, InputArray K, InputArray R) CV_OVERRIDE
Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) CV_OVERRIDE
Projects the image point.
Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE
Builds the projection maps according to the given camera data.
Rotation-only model image warper interface.
Definition: detail/warpers.hpp:60
virtual void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, Size dst_size, CV_OUT OutputArray dst)=0
Projects the image backward.
virtual Rect warpRoi(Size src_size, InputArray K, InputArray R)=0
virtual Point2f warpPointBackward(const Point2f &pt, InputArray K, InputArray R)=0
Projects the image point backward.
virtual Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, CV_OUT OutputArray dst)=0
Projects the image.
virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap)=0
Builds the projection maps according to the given camera data.
virtual Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R)=0
Projects the image point.
Definition: detail/warpers.hpp:629
Definition: detail/warpers.hpp:556
Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE
Builds the projection maps according to the given camera data.
Definition: detail/warpers.hpp:560
Warper that maps an image onto the unit sphere located at the origin.
Definition: detail/warpers.hpp:316
SphericalWarper(float scale)
Construct an instance of the spherical warper class.
Definition: detail/warpers.hpp:323
Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE
Builds the projection maps according to the given camera data.
Definition: detail/warpers.hpp:382
Definition: detail/warpers.hpp:495
#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: detail/warpers.hpp:410
Definition: detail/warpers.hpp:389
Definition: detail/warpers.hpp:638
Definition: detail/warpers.hpp:333
Definition: detail/warpers.hpp:361
Definition: detail/warpers.hpp:474
Definition: detail/warpers.hpp:452
Definition: detail/warpers.hpp:431
Definition: detail/warpers.hpp:657
Definition: detail/warpers.hpp:192
Base class for warping logic implementation.
Definition: detail/warpers.hpp:142
Definition: detail/warpers.hpp:620
Definition: detail/warpers.hpp:303
Definition: detail/warpers.hpp:375
Definition: detail/warpers.hpp:488