mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
TAPI: stitching: improve warpers
This commit is contained in:
committed by
Andrey Pavlenko
parent
89e3e448f5
commit
c1ea6f3c42
@@ -71,6 +71,7 @@
|
||||
#define LOG_(_level, _msg) \
|
||||
for(;;) \
|
||||
{ \
|
||||
using namespace std; \
|
||||
if ((_level) >= ::cv::detail::stitchingLogLevel()) \
|
||||
{ \
|
||||
LOG_STITCHING_MSG(_msg); \
|
||||
|
||||
@@ -160,6 +160,8 @@ class CV_EXPORTS SphericalWarper : public RotationWarperBase<SphericalProjector>
|
||||
public:
|
||||
SphericalWarper(float scale) { projector_.scale = scale; }
|
||||
|
||||
Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap);
|
||||
Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst);
|
||||
protected:
|
||||
void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br);
|
||||
};
|
||||
@@ -178,6 +180,8 @@ class CV_EXPORTS CylindricalWarper : public RotationWarperBase<CylindricalProjec
|
||||
public:
|
||||
CylindricalWarper(float scale) { projector_.scale = scale; }
|
||||
|
||||
Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap);
|
||||
Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst);
|
||||
protected:
|
||||
void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br)
|
||||
{
|
||||
@@ -503,45 +507,6 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
/////////////////////////////////////// OpenCL Accelerated Warpers /////////////////////////////////////
|
||||
|
||||
class CV_EXPORTS PlaneWarperOcl : public PlaneWarper
|
||||
{
|
||||
public:
|
||||
PlaneWarperOcl(float scale = 1.f) : PlaneWarper(scale) { }
|
||||
|
||||
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(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, 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
|
||||
{
|
||||
public:
|
||||
SphericalWarperOcl(float scale) : SphericalWarper(scale) { }
|
||||
|
||||
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
|
||||
{
|
||||
public:
|
||||
CylindricalWarperOcl(float scale) : CylindricalWarper(scale) { }
|
||||
|
||||
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
|
||||
} // namespace cv
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ template <class P>
|
||||
Point RotationWarperBase<P>::warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
|
||||
OutputArray dst)
|
||||
{
|
||||
Mat xmap, ymap;
|
||||
UMat xmap, ymap;
|
||||
Rect dst_roi = buildMaps(src.size(), K, R, xmap, ymap);
|
||||
|
||||
dst.create(dst_roi.height + 1, dst_roi.width + 1, src.type());
|
||||
|
||||
@@ -167,24 +167,6 @@ public:
|
||||
};
|
||||
#endif
|
||||
|
||||
class PlaneWarperOcl: public WarperCreator
|
||||
{
|
||||
public:
|
||||
Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::PlaneWarperOcl>(scale); }
|
||||
};
|
||||
|
||||
class SphericalWarperOcl: public WarperCreator
|
||||
{
|
||||
public:
|
||||
Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::SphericalWarperOcl>(scale); }
|
||||
};
|
||||
|
||||
class CylindricalWarperOcl: public WarperCreator
|
||||
{
|
||||
public:
|
||||
Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::CylindricalWarperOcl>(scale); }
|
||||
};
|
||||
|
||||
} // namespace cv
|
||||
|
||||
#endif // __OPENCV_STITCHING_WARPER_CREATORS_HPP__
|
||||
|
||||
Reference in New Issue
Block a user