Commit 27eb5d07 authored by Alexey Spizhevoy's avatar Alexey Spizhevoy

Added getScale/setScale for image warpers (stitching module)

parent 87737c20
...@@ -65,11 +65,13 @@ public: ...@@ -65,11 +65,13 @@ public:
virtual Point warp(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode, virtual Point warp(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode,
Mat &dst) = 0; 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, virtual void warpBackward(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode,
Size dst_size, Mat &dst) = 0; Size dst_size, Mat &dst) = 0;
virtual Rect warpRoi(Size src_size, const Mat &K, const Mat &R) = 0; virtual Rect warpRoi(Size src_size, const Mat &K, const Mat &R) = 0;
virtual float getScale() const { return 1.f; }
virtual void setScale(float) {}
}; };
...@@ -104,6 +106,9 @@ public: ...@@ -104,6 +106,9 @@ public:
Rect warpRoi(Size src_size, const Mat &K, const Mat &R); Rect warpRoi(Size src_size, const Mat &K, const Mat &R);
float getScale() const { return projector_.scale; }
void setScale(float val) { projector_.scale = val; }
protected: protected:
// Detects ROI of the destination image. It's correct for any projection. // Detects ROI of the destination image. It's correct for any projection.
...@@ -129,8 +134,6 @@ class CV_EXPORTS PlaneWarper : public RotationWarperBase<PlaneProjector> ...@@ -129,8 +134,6 @@ class CV_EXPORTS PlaneWarper : public RotationWarperBase<PlaneProjector>
public: public:
PlaneWarper(float scale = 1.f) { projector_.scale = scale; } PlaneWarper(float scale = 1.f) { projector_.scale = scale; }
void setScale(float scale) { projector_.scale = scale; }
Point2f warpPoint(const Point2f &pt, const Mat &K, const Mat &R, const Mat &T); Point2f warpPoint(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); Rect buildMaps(Size src_size, const Mat &K, const Mat &R, const Mat &T, Mat &xmap, Mat &ymap);
...@@ -225,12 +228,12 @@ struct CV_EXPORTS CompressedRectilinearProjector : ProjectorBase ...@@ -225,12 +228,12 @@ struct CV_EXPORTS CompressedRectilinearProjector : ProjectorBase
class CV_EXPORTS CompressedRectilinearWarper : public RotationWarperBase<CompressedRectilinearProjector> class CV_EXPORTS CompressedRectilinearWarper : public RotationWarperBase<CompressedRectilinearProjector>
{ {
public: public:
CompressedRectilinearWarper(float scale, float A = 1, float B = 1) CompressedRectilinearWarper(float scale, float A = 1, float B = 1)
{ {
projector_.a = A; projector_.a = A;
projector_.b = B; projector_.b = B;
projector_.scale = scale; projector_.scale = scale;
} }
}; };
...@@ -250,7 +253,7 @@ public: ...@@ -250,7 +253,7 @@ public:
{ {
projector_.a = A; projector_.a = A;
projector_.b = B; projector_.b = B;
projector_.scale = scale; projector_.scale = scale;
} }
}; };
...@@ -271,7 +274,7 @@ public: ...@@ -271,7 +274,7 @@ public:
{ {
projector_.a = A; projector_.a = A;
projector_.b = B; projector_.b = B;
projector_.scale = scale; projector_.scale = scale;
} }
}; };
...@@ -292,7 +295,7 @@ public: ...@@ -292,7 +295,7 @@ public:
{ {
projector_.a = A; projector_.a = A;
projector_.b = B; projector_.b = B;
projector_.scale = scale; projector_.scale = scale;
} }
}; };
......
...@@ -64,15 +64,6 @@ public: ...@@ -64,15 +64,6 @@ public:
// Creates stitcher with default parameters // Creates stitcher with default parameters
static Stitcher createDefault(bool try_use_gpu = false); static Stitcher createDefault(bool try_use_gpu = false);
Status estimateTransform(InputArray images);
Status estimateTransform(InputArray images, const std::vector<std::vector<Rect> > &rois);
Status composePanorama(OutputArray pano);
Status composePanorama(InputArray images, OutputArray pano);
Status stitch(InputArray images, OutputArray pano);
Status stitch(InputArray images, const std::vector<std::vector<Rect> > &rois, OutputArray pano);
double registrationResol() const { return registr_resol_; } double registrationResol() const { return registr_resol_; }
void setRegistrationResol(double resol_mpx) { registr_resol_ = resol_mpx; } void setRegistrationResol(double resol_mpx) { registr_resol_ = resol_mpx; }
...@@ -130,6 +121,19 @@ public: ...@@ -130,6 +121,19 @@ public:
const Ptr<detail::Blender> blender() const { return blender_; } const Ptr<detail::Blender> blender() const { return blender_; }
void setBlender(Ptr<detail::Blender> b) { blender_ = b; } void setBlender(Ptr<detail::Blender> b) { blender_ = b; }
Status estimateTransform(InputArray images);
Status estimateTransform(InputArray images, const std::vector<std::vector<Rect> > &rois);
Status composePanorama(OutputArray pano);
Status composePanorama(InputArray images, OutputArray pano);
Status stitch(InputArray images, OutputArray pano);
Status stitch(InputArray images, const std::vector<std::vector<Rect> > &rois, OutputArray pano);
std::vector<int> component() const { return indices_; }
std::vector<detail::CameraParams> cameras() const { return cameras_; }
double workScale() const { return work_scale_; }
private: private:
Stitcher() {} Stitcher() {}
......
...@@ -5,13 +5,15 @@ ...@@ -5,13 +5,15 @@
SET(OPENCV_CPP_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc SET(OPENCV_CPP_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc
opencv_highgui opencv_ml opencv_video opencv_objdetect opencv_photo opencv_nonfree opencv_highgui opencv_ml opencv_video opencv_objdetect opencv_photo opencv_nonfree
opencv_features2d opencv_calib3d opencv_legacy opencv_contrib opencv_stitching opencv_videostab) opencv_features2d opencv_calib3d opencv_legacy opencv_contrib opencv_stitching opencv_videostab opencv_core_vision_api)
ocv_check_dependencies(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS}) ocv_check_dependencies(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
add_definitions(-DENABLE_LOG)
if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
project(cpp_samples) project(core_vision_api_samples)
ocv_include_directories("${OpenCV_SOURCE_DIR}/include")#for opencv.hpp ocv_include_directories("${OpenCV_SOURCE_DIR}/include")#for opencv.hpp
ocv_include_modules(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS}) ocv_include_modules(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment