|
|
|
@ -56,17 +56,17 @@ class CV_EXPORTS RotationWarper |
|
|
|
|
public: |
|
|
|
|
virtual ~RotationWarper() {} |
|
|
|
|
|
|
|
|
|
virtual Point2f warpPoint(const Point2f &pt, const Mat &K, const Mat &R) = 0; |
|
|
|
|
virtual Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) = 0; |
|
|
|
|
|
|
|
|
|
virtual Rect buildMaps(Size src_size, const Mat &K, const Mat &R, Mat &xmap, Mat &ymap) = 0; |
|
|
|
|
virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) = 0; |
|
|
|
|
|
|
|
|
|
virtual Point warp(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode, |
|
|
|
|
Mat &dst) = 0; |
|
|
|
|
virtual Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, |
|
|
|
|
OutputArray dst) = 0; |
|
|
|
|
|
|
|
|
|
virtual void warpBackward(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode, |
|
|
|
|
Size dst_size, Mat &dst) = 0; |
|
|
|
|
virtual void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, |
|
|
|
|
Size dst_size, OutputArray dst) = 0; |
|
|
|
|
|
|
|
|
|
virtual Rect warpRoi(Size src_size, const Mat &K, const Mat &R) = 0; |
|
|
|
|
virtual Rect warpRoi(Size src_size, InputArray K, InputArray R) = 0; |
|
|
|
|
|
|
|
|
|
virtual float getScale() const { return 1.f; } |
|
|
|
|
virtual void setScale(float) {} |
|
|
|
@ -75,9 +75,9 @@ public: |
|
|
|
|
|
|
|
|
|
struct CV_EXPORTS ProjectorBase |
|
|
|
|
{ |
|
|
|
|
void setCameraParams(const Mat &K = Mat::eye(3, 3, CV_32F), |
|
|
|
|
const Mat &R = Mat::eye(3, 3, CV_32F), |
|
|
|
|
const Mat &T = Mat::zeros(3, 1, CV_32F)); |
|
|
|
|
void setCameraParams(InputArray K = Mat::eye(3, 3, CV_32F), |
|
|
|
|
InputArray R = Mat::eye(3, 3, CV_32F), |
|
|
|
|
InputArray T = Mat::zeros(3, 1, CV_32F)); |
|
|
|
|
|
|
|
|
|
float scale; |
|
|
|
|
float k[9]; |
|
|
|
@ -92,17 +92,17 @@ template <class P> |
|
|
|
|
class CV_EXPORTS RotationWarperBase : public RotationWarper |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
Point2f warpPoint(const Point2f &pt, const Mat &K, const Mat &R); |
|
|
|
|
Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R); |
|
|
|
|
|
|
|
|
|
Rect buildMaps(Size src_size, const Mat &K, const Mat &R, Mat &xmap, Mat &ymap); |
|
|
|
|
Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap); |
|
|
|
|
|
|
|
|
|
Point warp(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode, |
|
|
|
|
Mat &dst); |
|
|
|
|
Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, |
|
|
|
|
OutputArray dst); |
|
|
|
|
|
|
|
|
|
void warpBackward(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode, |
|
|
|
|
Size dst_size, Mat &dst); |
|
|
|
|
void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, |
|
|
|
|
Size dst_size, OutputArray dst); |
|
|
|
|
|
|
|
|
|
Rect warpRoi(Size src_size, const Mat &K, const Mat &R); |
|
|
|
|
Rect warpRoi(Size src_size, InputArray K, InputArray R); |
|
|
|
|
|
|
|
|
|
float getScale() const { return projector_.scale; } |
|
|
|
|
void setScale(float val) { projector_.scale = val; } |
|
|
|
@ -132,14 +132,14 @@ class CV_EXPORTS PlaneWarper : public RotationWarperBase<PlaneProjector> |
|
|
|
|
public: |
|
|
|
|
PlaneWarper(float scale = 1.f) { projector_.scale = scale; } |
|
|
|
|
|
|
|
|
|
Point2f warpPoint(const Point2f &pt, const Mat &K, const Mat &R, const Mat &T); |
|
|
|
|
Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R, InputArray T); |
|
|
|
|
|
|
|
|
|
virtual Rect buildMaps(Size src_size, const Mat &K, const Mat &R, const Mat &T, Mat &xmap, Mat &ymap); |
|
|
|
|
virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, OutputArray xmap, OutputArray ymap); |
|
|
|
|
|
|
|
|
|
virtual Point warp(const Mat &src, const Mat &K, const Mat &R, const Mat &T, int interp_mode, int border_mode, |
|
|
|
|
Mat &dst); |
|
|
|
|
virtual Point warp(InputArray src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode, |
|
|
|
|
OutputArray dst); |
|
|
|
|
|
|
|
|
|
Rect warpRoi(Size src_size, const Mat &K, const Mat &R, const Mat &T); |
|
|
|
|
Rect warpRoi(Size src_size, InputArray K, InputArray R, InputArray T); |
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
|
void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br); |
|
|
|
@ -333,7 +333,7 @@ class CV_EXPORTS PlaneWarperGpu : public PlaneWarper |
|
|
|
|
public: |
|
|
|
|
PlaneWarperGpu(float scale = 1.f) : PlaneWarper(scale) {} |
|
|
|
|
|
|
|
|
|
Rect buildMaps(Size src_size, const Mat &K, const Mat &R, Mat &xmap, Mat &ymap) |
|
|
|
|
Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) |
|
|
|
|
{ |
|
|
|
|
Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_); |
|
|
|
|
d_xmap_.download(xmap); |
|
|
|
@ -341,7 +341,7 @@ public: |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Rect buildMaps(Size src_size, const Mat &K, const Mat &R, const Mat &T, Mat &xmap, Mat &ymap) |
|
|
|
|
Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, OutputArray xmap, OutputArray ymap) |
|
|
|
|
{ |
|
|
|
|
Rect result = buildMaps(src_size, K, R, T, d_xmap_, d_ymap_); |
|
|
|
|
d_xmap_.download(xmap); |
|
|
|
@ -349,8 +349,8 @@ public: |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Point warp(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode, |
|
|
|
|
Mat &dst) |
|
|
|
|
Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, |
|
|
|
|
OutputArray dst) |
|
|
|
|
{ |
|
|
|
|
d_src_.upload(src); |
|
|
|
|
Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_); |
|
|
|
@ -358,8 +358,8 @@ public: |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Point warp(const Mat &src, const Mat &K, const Mat &R, const Mat &T, int interp_mode, int border_mode, |
|
|
|
|
Mat &dst) |
|
|
|
|
Point warp(InputArray src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode, |
|
|
|
|
OutputArray dst) |
|
|
|
|
{ |
|
|
|
|
d_src_.upload(src); |
|
|
|
|
Point result = warp(d_src_, K, R, T, interp_mode, border_mode, d_dst_); |
|
|
|
@ -367,15 +367,15 @@ public: |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Rect buildMaps(Size src_size, const Mat &K, const Mat &R, cuda::GpuMat &xmap, cuda::GpuMat &ymap); |
|
|
|
|
Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap); |
|
|
|
|
|
|
|
|
|
Rect buildMaps(Size src_size, const Mat &K, const Mat &R, const Mat &T, cuda::GpuMat &xmap, cuda::GpuMat &ymap); |
|
|
|
|
Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, cuda::GpuMat & xmap, cuda::GpuMat & ymap); |
|
|
|
|
|
|
|
|
|
Point warp(const cuda::GpuMat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode, |
|
|
|
|
cuda::GpuMat &dst); |
|
|
|
|
Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode, |
|
|
|
|
cuda::GpuMat & dst); |
|
|
|
|
|
|
|
|
|
Point warp(const cuda::GpuMat &src, const Mat &K, const Mat &R, const Mat &T, int interp_mode, int border_mode, |
|
|
|
|
cuda::GpuMat &dst); |
|
|
|
|
Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode, |
|
|
|
|
cuda::GpuMat & dst); |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_; |
|
|
|
@ -387,7 +387,7 @@ class CV_EXPORTS SphericalWarperGpu : public SphericalWarper |
|
|
|
|
public: |
|
|
|
|
SphericalWarperGpu(float scale) : SphericalWarper(scale) {} |
|
|
|
|
|
|
|
|
|
Rect buildMaps(Size src_size, const Mat &K, const Mat &R, Mat &xmap, Mat &ymap) |
|
|
|
|
Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) |
|
|
|
|
{ |
|
|
|
|
Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_); |
|
|
|
|
d_xmap_.download(xmap); |
|
|
|
@ -395,8 +395,8 @@ public: |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Point warp(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode, |
|
|
|
|
Mat &dst) |
|
|
|
|
Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, |
|
|
|
|
OutputArray dst) |
|
|
|
|
{ |
|
|
|
|
d_src_.upload(src); |
|
|
|
|
Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_); |
|
|
|
@ -404,10 +404,10 @@ public: |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Rect buildMaps(Size src_size, const Mat &K, const Mat &R, cuda::GpuMat &xmap, cuda::GpuMat &ymap); |
|
|
|
|
Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap); |
|
|
|
|
|
|
|
|
|
Point warp(const cuda::GpuMat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode, |
|
|
|
|
cuda::GpuMat &dst); |
|
|
|
|
Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode, |
|
|
|
|
cuda::GpuMat & dst); |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_; |
|
|
|
@ -419,7 +419,7 @@ class CV_EXPORTS CylindricalWarperGpu : public CylindricalWarper |
|
|
|
|
public: |
|
|
|
|
CylindricalWarperGpu(float scale) : CylindricalWarper(scale) {} |
|
|
|
|
|
|
|
|
|
Rect buildMaps(Size src_size, const Mat &K, const Mat &R, Mat &xmap, Mat &ymap) |
|
|
|
|
Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) |
|
|
|
|
{ |
|
|
|
|
Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_); |
|
|
|
|
d_xmap_.download(xmap); |
|
|
|
@ -427,8 +427,8 @@ public: |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Point warp(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode, |
|
|
|
|
Mat &dst) |
|
|
|
|
Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, |
|
|
|
|
OutputArray dst) |
|
|
|
|
{ |
|
|
|
|
d_src_.upload(src); |
|
|
|
|
Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_); |
|
|
|
@ -436,10 +436,10 @@ public: |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Rect buildMaps(Size src_size, const Mat &K, const Mat &R, cuda::GpuMat &xmap, cuda::GpuMat &ymap); |
|
|
|
|
Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap); |
|
|
|
|
|
|
|
|
|
Point warp(const cuda::GpuMat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode, |
|
|
|
|
cuda::GpuMat &dst); |
|
|
|
|
Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode, |
|
|
|
|
cuda::GpuMat & dst); |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_; |
|
|
|
@ -510,18 +510,18 @@ class CV_EXPORTS PlaneWarperOcl : public PlaneWarper |
|
|
|
|
public: |
|
|
|
|
PlaneWarperOcl(float scale = 1.f) : PlaneWarper(scale) { } |
|
|
|
|
|
|
|
|
|
virtual Rect buildMaps(Size src_size, const Mat &K, const Mat &R, Mat &xmap, Mat &ymap) |
|
|
|
|
virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) |
|
|
|
|
{ |
|
|
|
|
return buildMaps(src_size, K, R, Mat::zeros(3, 1, CV_32FC1), xmap, ymap); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
virtual Point warp(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode, Mat &dst) |
|
|
|
|
virtual Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst) |
|
|
|
|
{ |
|
|
|
|
return warp(src, K, R, Mat::zeros(3, 1, CV_32FC1), interp_mode, border_mode, dst); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
virtual Rect buildMaps(Size src_size, const Mat &K, const Mat &R, const Mat &T, Mat &xmap, Mat &ymap); |
|
|
|
|
virtual Point warp(const Mat &src, const Mat &K, const Mat &R, const Mat &T, int interp_mode, int border_mode, Mat &dst); |
|
|
|
|
virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, OutputArray xmap, OutputArray ymap); |
|
|
|
|
virtual Point warp(InputArray src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode, OutputArray dst); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
class CV_EXPORTS SphericalWarperOcl : public SphericalWarper |
|
|
|
@ -529,8 +529,8 @@ class CV_EXPORTS SphericalWarperOcl : public SphericalWarper |
|
|
|
|
public: |
|
|
|
|
SphericalWarperOcl(float scale) : SphericalWarper(scale) { } |
|
|
|
|
|
|
|
|
|
virtual Rect buildMaps(Size src_size, const Mat &K, const Mat &R, Mat &xmap, Mat &ymap); |
|
|
|
|
virtual Point warp(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode, Mat &dst); |
|
|
|
|
virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap); |
|
|
|
|
virtual Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
class CV_EXPORTS CylindricalWarperOcl : public CylindricalWarper |
|
|
|
@ -538,8 +538,8 @@ class CV_EXPORTS CylindricalWarperOcl : public CylindricalWarper |
|
|
|
|
public: |
|
|
|
|
CylindricalWarperOcl(float scale) : CylindricalWarper(scale) { } |
|
|
|
|
|
|
|
|
|
virtual Rect buildMaps(Size src_size, const Mat &K, const Mat &R, Mat &xmap, Mat &ymap); |
|
|
|
|
virtual Point warp(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode, Mat &dst); |
|
|
|
|
virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap); |
|
|
|
|
virtual Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
} // namespace detail
|
|
|
|
|