diff --git a/modules/stitching/include/opencv2/stitching/detail/warpers.hpp b/modules/stitching/include/opencv2/stitching/detail/warpers.hpp index 645049c84d..7ba8e7da70 100644 --- a/modules/stitching/include/opencv2/stitching/detail/warpers.hpp +++ b/modules/stitching/include/opencv2/stitching/detail/warpers.hpp @@ -65,11 +65,13 @@ public: 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; 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: 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: // Detects ROI of the destination image. It's correct for any projection. @@ -129,8 +134,6 @@ class CV_EXPORTS PlaneWarper : public RotationWarperBase public: 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); 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 class CV_EXPORTS CompressedRectilinearWarper : public RotationWarperBase { public: - CompressedRectilinearWarper(float scale, float A = 1, float B = 1) - { - projector_.a = A; - projector_.b = B; - projector_.scale = scale; - } + CompressedRectilinearWarper(float scale, float A = 1, float B = 1) + { + projector_.a = A; + projector_.b = B; + projector_.scale = scale; + } }; @@ -250,7 +253,7 @@ public: { projector_.a = A; projector_.b = B; - projector_.scale = scale; + projector_.scale = scale; } }; @@ -271,7 +274,7 @@ public: { projector_.a = A; projector_.b = B; - projector_.scale = scale; + projector_.scale = scale; } }; @@ -292,7 +295,7 @@ public: { projector_.a = A; projector_.b = B; - projector_.scale = scale; + projector_.scale = scale; } }; diff --git a/modules/stitching/include/opencv2/stitching/stitcher.hpp b/modules/stitching/include/opencv2/stitching/stitcher.hpp index c535c5277e..e274deb173 100644 --- a/modules/stitching/include/opencv2/stitching/stitcher.hpp +++ b/modules/stitching/include/opencv2/stitching/stitcher.hpp @@ -64,15 +64,6 @@ public: // Creates stitcher with default parameters static Stitcher createDefault(bool try_use_gpu = false); - Status estimateTransform(InputArray images); - Status estimateTransform(InputArray images, const std::vector > &rois); - - Status composePanorama(OutputArray pano); - Status composePanorama(InputArray images, OutputArray pano); - - Status stitch(InputArray images, OutputArray pano); - Status stitch(InputArray images, const std::vector > &rois, OutputArray pano); - double registrationResol() const { return registr_resol_; } void setRegistrationResol(double resol_mpx) { registr_resol_ = resol_mpx; } @@ -130,6 +121,19 @@ public: const Ptr blender() const { return blender_; } void setBlender(Ptr b) { blender_ = b; } + Status estimateTransform(InputArray images); + Status estimateTransform(InputArray images, const std::vector > &rois); + + Status composePanorama(OutputArray pano); + Status composePanorama(InputArray images, OutputArray pano); + + Status stitch(InputArray images, OutputArray pano); + Status stitch(InputArray images, const std::vector > &rois, OutputArray pano); + + std::vector component() const { return indices_; } + std::vector cameras() const { return cameras_; } + double workScale() const { return work_scale_; } + private: Stitcher() {} diff --git a/samples/cpp/CMakeLists.txt b/samples/cpp/CMakeLists.txt index c2b49a75ee..04f1220b26 100644 --- a/samples/cpp/CMakeLists.txt +++ b/samples/cpp/CMakeLists.txt @@ -5,13 +5,15 @@ 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_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}) +add_definitions(-DENABLE_LOG) + 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_modules(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})