diff --git a/modules/stitching/doc/motion_estimation.rst b/modules/stitching/doc/motion_estimation.rst index 6e8073381b..b3a098855d 100644 --- a/modules/stitching/doc/motion_estimation.rst +++ b/modules/stitching/doc/motion_estimation.rst @@ -154,7 +154,7 @@ detail::BundleAdjusterBase::setUpInitialCameraParams Sets initial camera parameter to refine. -.. ocv:function:: void detail::BundleAdjusterBase::setUpInitialCameraParams(const std::vector &cameras) = 0; +.. ocv:function:: void detail::BundleAdjusterBase::setUpInitialCameraParams(const std::vector &cameras) :param cameras: Camera parameters @@ -163,7 +163,7 @@ detail::BundleAdjusterBase::calcError Calculates error vector. -.. ocv:function:: void detail::BundleAdjusterBase::calcError(Mat &err) = 0; +.. ocv:function:: void detail::BundleAdjusterBase::calcError(Mat &err) :param err: Error column-vector of length ``total_num_matches * num_errs_per_measurement`` @@ -172,7 +172,7 @@ detail::BundleAdjusterBase::calcJacobian Calculates the cost function jacobian. -.. ocv:function:: void detail::BundleAdjusterBase::calcJacobian(Mat &jac) = 0; +.. ocv:function:: void detail::BundleAdjusterBase::calcJacobian(Mat &jac) :param jac: Jacobian matrix of dimensions ``(total_num_matches * num_errs_per_measurement) x (num_images * num_params_per_cam)`` @@ -181,7 +181,7 @@ detail::BundleAdjusterBase::obtainRefinedCameraParams Gets the refined camera parameters. -.. ocv:function:: void detail::BundleAdjusterBase::obtainRefinedCameraParams(std::vector &cameras) const = 0; +.. ocv:function:: void detail::BundleAdjusterBase::obtainRefinedCameraParams(std::vector &cameras) const :param cameras: Refined camera parameters @@ -200,7 +200,7 @@ Implementation of the camera parameters refinement algorithm which minimizes sum /* hidden */ }; -.. seealso:: :ocv:class:`detail::BundleAdjusterBase` +.. seealso:: :ocv:class:`detail::BundleAdjusterBase`, :ocv:class:`detail::Estimator` detail::BundleAdjusterRay ------------------------- diff --git a/modules/stitching/doc/warpers.rst b/modules/stitching/doc/warpers.rst index 401e0f529c..4309495f81 100644 --- a/modules/stitching/doc/warpers.rst +++ b/modules/stitching/doc/warpers.rst @@ -7,7 +7,7 @@ detail::RotationWarper ---------------------- .. ocv:class:: detail::RotationWarper -Rotation-only model image warpers interface. :: +Rotation-only model image warper interface. :: class CV_EXPORTS RotationWarper { @@ -27,6 +27,149 @@ Rotation-only model image warpers interface. :: virtual Rect warpRoi(Size src_size, const Mat &K, const Mat &R) = 0; }; +detail::RotationWarper::warpPoint +--------------------------------- + +Projects the image point. + +.. ocv:function:: Point2f detail::RotationWarper::warpPoint(const Point2f &pt, const Mat &K, const Mat &R) + + :param pt: Source point + + :param K: Camera intrinsic parameters + + :param R: Camera rotation matrix + + :return: Projected point + +detail::RotationWarper::buildMaps +--------------------------------- + +Builds the projection maps according to the given camera data. + +.. ocv:function:: Rect detail::RotationWarper::buildMaps(Size src_size, const Mat &K, const Mat &R, Mat &xmap, Mat &ymap) + + :param src_size: Source image size + + :param K: Camera intrinsic parameters + + :param R: Camera rotation matrix + + :param xmap: Projection map for the x axis + + :param ymap: Projection map for the y axis + + :return: Projected image minimum bounding box + +detail::RotationWarper::warp +---------------------------- + +Projects the image. + +.. ocv:function:: Point detal::RotationWarper::warp(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode, Mat &dst) + + :param src: Source image + + :param K: Camera intrinsic parameters + + :param R: Camera rotation matrix + + :param interp_mode: Interpolation mode + + :param border_mode: Border extrapolation mode + + :param dst: Projected image + + :return: Project image top-left corner + +detail::RotationWarper::warpBackward +------------------------------------ + +Projects the image backward. + +.. ocv:function:: void detail::RotationWarper::warpBackward(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode, Size dst_size, Mat &dst) + + :param src: Projected image + + :param K: Camera intrinsic parameters + + :param R: Camera rotation matrix + + :param interp_mode: Interpolation mode + + :param border_mode: Border extrapolation mode + + :param dst_size: Backward-projected image size + + :param dst_size: Backward-projected image + +detail::RotationWarper::warpRoi +------------------------------- + +.. ocv:function:: Rect detail::RotationWarper::warpRoi(Size src_size, const Mat &K, const Mat &R) + + :param src_size: Source image bounding box + + :param K: Camera intrinsic parameters + + :param R: Camera rotation matrix + + :return: Projected image minimum bounding box + +detail::ProjectorBase +--------------------- +.. ocv:struct:: detail::ProjectorBase + +Base class for warping logic implementation. :: + + 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)); + + float scale; + float k[9]; + float rinv[9]; + float r_kinv[9]; + float k_rinv[9]; + float t[3]; + }; + +detail::RotationWarperBase +-------------------------- +.. ocv:class:: detail::RotationWarperBase + +Base class for rotation-based warper using a `detail::ProjectorBase`_ derived class. :: + + template + class CV_EXPORTS RotationWarperBase : public RotationWarper + { + public: + Point2f warpPoint(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, + Mat &dst); + + void warpBackward(const Mat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode, + Size dst_size, Mat &dst); + + Rect warpRoi(Size src_size, const Mat &K, const Mat &R); + + protected: + + // Detects ROI of the destination image. It's correct for any projection. + virtual void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br); + + // Detects ROI of the destination image by walking over image border. + // Correctness for any projection isn't guaranteed. + void detectResultRoiByBorder(Size src_size, Point &dst_tl, Point &dst_br); + + P projector_; + }; + detail::PlaneWarper ------------------- .. ocv:class:: detail::PlaneWarper