Added warp method into the RotationWarper interface, added find() into VoronoiSeamFinder which uses only source image sizes

This commit is contained in:
Alexey Spizhevoy
2011-10-07 08:17:55 +00:00
parent 9ae8443d37
commit a7fbcad283
5 changed files with 66 additions and 9 deletions

View File

@@ -71,9 +71,11 @@ public:
std::vector<Mat> &masks);
protected:
void run();
virtual void findInPair(size_t first, size_t second, Rect roi) = 0;
std::vector<Mat> images_;
std::vector<Size> sizes_;
std::vector<Point> corners_;
std::vector<Mat> masks_;
};
@@ -81,6 +83,9 @@ protected:
class CV_EXPORTS VoronoiSeamFinder : public PairwiseSeamFinder
{
public:
virtual void find(const std::vector<Size> &size, const std::vector<Point> &corners,
std::vector<Mat> &masks);
private:
void findInPair(size_t first, size_t second, Rect roi);
};

View File

@@ -57,11 +57,14 @@ class CV_EXPORTS RotationWarper
public:
virtual ~RotationWarper() {}
virtual Point2f warp(const Point2f &pt, const Mat &K, const Mat &R) = 0;
virtual Rect buildMaps(Size src_size, const Mat &K, const Mat &R, Mat &xmap, Mat &ymap) = 0;
virtual Point warp(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode,
Mat &dst) = 0;
// TODO add other backward functions for consistency or move this into a separated interface
virtual void warpBackward(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode,
Size dst_size, Mat &dst) = 0;
@@ -88,6 +91,8 @@ template <class P>
class CV_EXPORTS RotationWarperBase : public RotationWarper
{
public:
Point2f warp(const Point2f &pt, const Mat &K, const Mat &R);
Rect buildMaps(Size src_size, const Mat &K, const Mat &R, Mat &xmap, Mat &ymap);
Point warp(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode,
@@ -126,6 +131,8 @@ public:
void setScale(float scale) { projector_.scale = scale; }
Point2f warp(const Point2f &pt, const Mat &K, const Mat &R, const Mat &T);
Rect buildMaps(Size src_size, const Mat &K, const Mat &R, const Mat &T, Mat &xmap, Mat &ymap);
Point warp(const Mat &src, const Mat &K, const Mat &R, const Mat &T, int interp_mode, int border_mode,

View File

@@ -49,6 +49,16 @@
namespace cv {
namespace detail {
template <class P>
Point2f RotationWarperBase<P>::warp(const Point2f &pt, const Mat &K, const Mat &R)
{
projector_.setCameraParams(K, R);
Point2f uv;
projector_.mapForward(pt.x, pt.y, uv.x, uv.y);
return uv;
}
template <class P>
Rect RotationWarperBase<P>::buildMaps(Size src_size, const Mat &K, const Mat &R, Mat &xmap, Mat &ymap)
{