diff --git a/modules/shape/include/opencv2/shape.hpp b/modules/shape/include/opencv2/shape.hpp index d07bf5e45..093d8575d 100644 --- a/modules/shape/include/opencv2/shape.hpp +++ b/modules/shape/include/opencv2/shape.hpp @@ -48,6 +48,10 @@ #include "opencv2/shape/hist_cost.hpp" #include "opencv2/shape/shape_distance.hpp" +/** + @defgroup shape Shape Distance and Matching + */ + namespace cv { CV_EXPORTS bool initModule_shape(); diff --git a/modules/shape/include/opencv2/shape/emdL1.hpp b/modules/shape/include/opencv2/shape/emdL1.hpp index 74c734a51..1dfa7581a 100644 --- a/modules/shape/include/opencv2/shape/emdL1.hpp +++ b/modules/shape/include/opencv2/shape/emdL1.hpp @@ -51,8 +51,22 @@ namespace cv * EMDL1 Function * \****************************************************************************************/ +//! @addtogroup shape +//! @{ + +/** @brief Computes the "minimal work" distance between two weighted point configurations base on the papers +"EMD-L1: An efficient and Robust Algorithm for comparing histogram-based descriptors", by Haibin +Ling and Kazunori Okuda; and "The Earth Mover's Distance is the Mallows Distance: Some Insights from +Statistics", by Elizaveta Levina and Peter Bickel. + +@param signature1 First signature, a single column floating-point matrix. Each row is the value of +the histogram in each bin. +@param signature2 Second signature of the same format and size as signature1. + */ CV_EXPORTS float EMDL1(InputArray signature1, InputArray signature2); +//! @} + }//namespace cv #endif diff --git a/modules/shape/include/opencv2/shape/hist_cost.hpp b/modules/shape/include/opencv2/shape/hist_cost.hpp index 0ff3573ee..15c0a87c7 100644 --- a/modules/shape/include/opencv2/shape/hist_cost.hpp +++ b/modules/shape/include/opencv2/shape/hist_cost.hpp @@ -49,8 +49,10 @@ namespace cv { -/*! - * The base class for HistogramCostExtractor. +//! @addtogroup shape +//! @{ + +/** @brief Abstract base class for histogram cost algorithms. */ class CV_EXPORTS_W HistogramCostExtractor : public Algorithm { @@ -64,7 +66,8 @@ public: CV_WRAP virtual float getDefaultCost() const = 0; }; -/*! */ +/** @brief A norm based cost extraction. : + */ class CV_EXPORTS_W NormHistogramCostExtractor : public HistogramCostExtractor { public: @@ -75,7 +78,8 @@ public: CV_EXPORTS_W Ptr createNormHistogramCostExtractor(int flag=DIST_L2, int nDummies=25, float defaultCost=0.2f); -/*! */ +/** @brief An EMD based cost extraction. : + */ class CV_EXPORTS_W EMDHistogramCostExtractor : public HistogramCostExtractor { public: @@ -86,18 +90,22 @@ public: CV_EXPORTS_W Ptr createEMDHistogramCostExtractor(int flag=DIST_L2, int nDummies=25, float defaultCost=0.2f); -/*! */ +/** @brief An Chi based cost extraction. : + */ class CV_EXPORTS_W ChiHistogramCostExtractor : public HistogramCostExtractor {}; CV_EXPORTS_W Ptr createChiHistogramCostExtractor(int nDummies=25, float defaultCost=0.2f); -/*! */ +/** @brief An EMD-L1 based cost extraction. : + */ class CV_EXPORTS_W EMDL1HistogramCostExtractor : public HistogramCostExtractor {}; CV_EXPORTS_W Ptr createEMDL1HistogramCostExtractor(int nDummies=25, float defaultCost=0.2f); +//! @} + } // cv #endif diff --git a/modules/shape/include/opencv2/shape/shape_distance.hpp b/modules/shape/include/opencv2/shape/shape_distance.hpp index acdb6e5f6..c19d3fe01 100644 --- a/modules/shape/include/opencv2/shape/shape_distance.hpp +++ b/modules/shape/include/opencv2/shape/shape_distance.hpp @@ -50,65 +50,131 @@ namespace cv { -/*! - * The base class for ShapeDistanceExtractor. - * This is just to define the common interface for - * shape comparisson techniques. +//! @addtogroup shape +//! @{ + +/** @brief Abstract base class for shape distance algorithms. */ class CV_EXPORTS_W ShapeDistanceExtractor : public Algorithm { public: + /** @brief Compute the shape distance between two shapes defined by its contours. + + @param contour1 Contour defining first shape. + @param contour2 Contour defining second shape. + */ CV_WRAP virtual float computeDistance(InputArray contour1, InputArray contour2) = 0; }; /***********************************************************************************/ /***********************************************************************************/ /***********************************************************************************/ -/*! - * Shape Context implementation. - * The SCD class implements SCD algorithm proposed by Belongie et al.in - * "Shape Matching and Object Recognition Using Shape Contexts". - * Implemented by Juan M. Perez for the GSOC 2013. - */ +/** @brief Implementation of the Shape Context descriptor and matching algorithm + +proposed by Belongie et al. in "Shape Matching and Object Recognition Using Shape Contexts" (PAMI +2002). This implementation is packaged in a generic scheme, in order to allow you the +implementation of the common variations of the original pipeline. +*/ class CV_EXPORTS_W ShapeContextDistanceExtractor : public ShapeDistanceExtractor { public: + /** @brief Establish the number of angular bins for the Shape Context Descriptor used in the shape matching + pipeline. + + @param nAngularBins The number of angular bins in the shape context descriptor. + */ CV_WRAP virtual void setAngularBins(int nAngularBins) = 0; CV_WRAP virtual int getAngularBins() const = 0; + /** @brief Establish the number of radial bins for the Shape Context Descriptor used in the shape matching + pipeline. + + @param nRadialBins The number of radial bins in the shape context descriptor. + */ CV_WRAP virtual void setRadialBins(int nRadialBins) = 0; CV_WRAP virtual int getRadialBins() const = 0; + /** @brief Set the inner radius of the shape context descriptor. + + @param innerRadius The value of the inner radius. + */ CV_WRAP virtual void setInnerRadius(float innerRadius) = 0; CV_WRAP virtual float getInnerRadius() const = 0; + /** @brief Set the outer radius of the shape context descriptor. + + @param outerRadius The value of the outer radius. + */ CV_WRAP virtual void setOuterRadius(float outerRadius) = 0; CV_WRAP virtual float getOuterRadius() const = 0; CV_WRAP virtual void setRotationInvariant(bool rotationInvariant) = 0; CV_WRAP virtual bool getRotationInvariant() const = 0; + /** @brief Set the weight of the shape context distance in the final value of the shape distance. The shape + context distance between two shapes is defined as the symmetric sum of shape context matching costs + over best matching points. The final value of the shape distance is a user-defined linear + combination of the shape context distance, an image appearance distance, and a bending energy. + + @param shapeContextWeight The weight of the shape context distance in the final distance value. + */ CV_WRAP virtual void setShapeContextWeight(float shapeContextWeight) = 0; CV_WRAP virtual float getShapeContextWeight() const = 0; + /** @brief Set the weight of the Image Appearance cost in the final value of the shape distance. The image + appearance cost is defined as the sum of squared brightness differences in Gaussian windows around + corresponding image points. The final value of the shape distance is a user-defined linear + combination of the shape context distance, an image appearance distance, and a bending energy. If + this value is set to a number different from 0, is mandatory to set the images that correspond to + each shape. + + @param imageAppearanceWeight The weight of the appearance cost in the final distance value. + */ CV_WRAP virtual void setImageAppearanceWeight(float imageAppearanceWeight) = 0; CV_WRAP virtual float getImageAppearanceWeight() const = 0; + /** @brief Set the weight of the Bending Energy in the final value of the shape distance. The bending energy + definition depends on what transformation is being used to align the shapes. The final value of the + shape distance is a user-defined linear combination of the shape context distance, an image + appearance distance, and a bending energy. + + @param bendingEnergyWeight The weight of the Bending Energy in the final distance value. + */ CV_WRAP virtual void setBendingEnergyWeight(float bendingEnergyWeight) = 0; CV_WRAP virtual float getBendingEnergyWeight() const = 0; + /** @brief Set the images that correspond to each shape. This images are used in the calculation of the Image + Appearance cost. + + @param image1 Image corresponding to the shape defined by contours1. + @param image2 Image corresponding to the shape defined by contours2. + */ CV_WRAP virtual void setImages(InputArray image1, InputArray image2) = 0; CV_WRAP virtual void getImages(OutputArray image1, OutputArray image2) const = 0; CV_WRAP virtual void setIterations(int iterations) = 0; CV_WRAP virtual int getIterations() const = 0; + /** @brief Set the algorithm used for building the shape context descriptor cost matrix. + + @param comparer Smart pointer to a HistogramCostExtractor, an algorithm that defines the cost + matrix between descriptors. + */ CV_WRAP virtual void setCostExtractor(Ptr comparer) = 0; CV_WRAP virtual Ptr getCostExtractor() const = 0; + /** @brief Set the value of the standard deviation for the Gaussian window for the image appearance cost. + + @param sigma Standard Deviation. + */ CV_WRAP virtual void setStdDev(float sigma) = 0; CV_WRAP virtual float getStdDev() const = 0; + /** @brief Set the algorithm used for aligning the shapes. + + @param transformer Smart pointer to a ShapeTransformer, an algorithm that defines the aligning + transformation. + */ CV_WRAP virtual void setTransformAlgorithm(Ptr transformer) = 0; CV_WRAP virtual Ptr getTransformAlgorithm() const = 0; }; @@ -123,15 +189,28 @@ CV_EXPORTS_W Ptr /***********************************************************************************/ /***********************************************************************************/ /***********************************************************************************/ -/*! - * Hausdorff distace implementation based on +/** @brief A simple Hausdorff distance measure between shapes defined by contours + +according to the paper "Comparing Images using the Hausdorff distance." by D.P. Huttenlocher, G.A. +Klanderman, and W.J. Rucklidge. (PAMI 1993). : */ class CV_EXPORTS_W HausdorffDistanceExtractor : public ShapeDistanceExtractor { public: + /** @brief Set the norm used to compute the Hausdorff value between two shapes. It can be L1 or L2 norm. + + @param distanceFlag Flag indicating which norm is used to compute the Hausdorff distance + (NORM\_L1, NORM\_L2). + */ CV_WRAP virtual void setDistanceFlag(int distanceFlag) = 0; CV_WRAP virtual int getDistanceFlag() const = 0; + /** @brief This method sets the rank proportion (or fractional value) that establish the Kth ranked value of + the partial Hausdorff distance. Experimentally had been shown that 0.6 is a good value to compare + shapes. + + @param rankProportion fractional value (between 0 and 1). + */ CV_WRAP virtual void setRankProportion(float rankProportion) = 0; CV_WRAP virtual float getRankProportion() const = 0; }; @@ -139,5 +218,7 @@ public: /* Constructor */ CV_EXPORTS_W Ptr createHausdorffDistanceExtractor(int distanceFlag=cv::NORM_L2, float rankProp=0.6f); +//! @} + } // cv #endif diff --git a/modules/shape/include/opencv2/shape/shape_transformer.hpp b/modules/shape/include/opencv2/shape/shape_transformer.hpp index cdabf971c..218061367 100644 --- a/modules/shape/include/opencv2/shape/shape_transformer.hpp +++ b/modules/shape/include/opencv2/shape/shape_transformer.hpp @@ -50,20 +50,38 @@ namespace cv { -/*! - * The base class for ShapeTransformer. - * This is just to define the common interface for - * shape transformation techniques. +//! @addtogroup shape +//! @{ + +/** @brief Abstract base class for shape transformation algorithms. */ class CV_EXPORTS_W ShapeTransformer : public Algorithm { public: - /* Estimate, Apply Transformation and return Transforming cost*/ + /** @brief Estimate the transformation parameters of the current transformer algorithm, based on point matches. + + @param transformingShape Contour defining first shape. + @param targetShape Contour defining second shape (Target). + @param matches Standard vector of Matches between points. + */ CV_WRAP virtual void estimateTransformation(InputArray transformingShape, InputArray targetShape, std::vector& matches) = 0; + /** @brief Apply a transformation, given a pre-estimated transformation parameters. + + @param input Contour (set of points) to apply the transformation. + @param output Output contour. + */ CV_WRAP virtual float applyTransformation(InputArray input, OutputArray output=noArray()) = 0; + /** @brief Apply a transformation, given a pre-estimated transformation parameters, to an Image. + + @param transformingImage Input image. + @param output Output image. + @param flags Image interpolation method. + @param borderMode border style. + @param borderValue border value. + */ CV_WRAP virtual void warpImage(InputArray transformingImage, OutputArray output, int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, const Scalar& borderValue=Scalar()) const = 0; @@ -71,30 +89,33 @@ public: /***********************************************************************************/ /***********************************************************************************/ -/*! - * Thin Plate Spline Transformation - * Implementation of the TPS transformation - * according to "Principal Warps: Thin-Plate Splines and the - * Decomposition of Deformations" by Juan Manuel Perez for the GSOC 2013 - */ +/** @brief Definition of the transformation + +ocupied in the paper "Principal Warps: Thin-Plate Splines and Decomposition of Deformations", by +F.L. Bookstein (PAMI 1989). : + */ class CV_EXPORTS_W ThinPlateSplineShapeTransformer : public ShapeTransformer { public: + /** @brief Set the regularization parameter for relaxing the exact interpolation requirements of the TPS + algorithm. + + @param beta value of the regularization parameter. + */ CV_WRAP virtual void setRegularizationParameter(double beta) = 0; CV_WRAP virtual double getRegularizationParameter() const = 0; }; -/* Complete constructor */ +/** Complete constructor */ CV_EXPORTS_W Ptr createThinPlateSplineShapeTransformer(double regularizationParameter=0); /***********************************************************************************/ /***********************************************************************************/ -/*! - * Affine Transformation as a derivated from ShapeTransformer - */ +/** @brief Wrapper class for the OpenCV Affine Transformation algorithm. : + */ class CV_EXPORTS_W AffineTransformer : public ShapeTransformer { public: @@ -102,8 +123,10 @@ public: CV_WRAP virtual bool getFullAffine() const = 0; }; -/* Complete constructor */ +/** Complete constructor */ CV_EXPORTS_W Ptr createAffineTransformer(bool fullAffine); +//! @} + } // cv #endif diff --git a/modules/superres/include/opencv2/superres.hpp b/modules/superres/include/opencv2/superres.hpp index 3d96e0f71..28dcbd771 100644 --- a/modules/superres/include/opencv2/superres.hpp +++ b/modules/superres/include/opencv2/superres.hpp @@ -45,10 +45,23 @@ #include "opencv2/core.hpp" +/** + @defgroup superres Super Resolution + +The Super Resolution module contains a set of functions and classes that can be used to solve the +problem of resolution enhancement. There are a few methods implemented, most of them are descibed in +the papers @cite Farsiu03 and @cite Mitzel09. + + */ + namespace cv { namespace superres { + +//! @addtogroup superres +//! @{ + CV_EXPORTS bool initModule_superres(); class CV_EXPORTS FrameSource @@ -67,14 +80,29 @@ namespace cv CV_EXPORTS Ptr createFrameSource_Camera(int deviceId = 0); + /** @brief Base class for Super Resolution algorithms. + + The class is only used to define the common interface for the whole family of Super Resolution + algorithms. + */ class CV_EXPORTS SuperResolution : public cv::Algorithm, public FrameSource { public: + /** @brief Set input frame source for Super Resolution algorithm. + + @param frameSource Input frame source + */ void setInput(const Ptr& frameSource); + /** @brief Process next frame from input and return output result. + + @param frame Output result + */ void nextFrame(OutputArray frame); void reset(); + /** @brief Clear all inner buffers. + */ virtual void collectGarbage(); protected: @@ -90,11 +118,31 @@ namespace cv bool firstCall_; }; - // S. Farsiu , D. Robinson, M. Elad, P. Milanfar. Fast and robust multiframe super resolution. - // Dennis Mitzel, Thomas Pock, Thomas Schoenemann, Daniel Cremers. Video Super Resolution using Duality Based TV-L1 Optical Flow. + /** @brief Create Bilateral TV-L1 Super Resolution. + + This class implements Super Resolution algorithm described in the papers @cite Farsiu03 and + @cite Mitzel09 . + + Here are important members of the class that control the algorithm, which you can set after + constructing the class instance: + + - **int scale** Scale factor. + - **int iterations** Iteration count. + - **double tau** Asymptotic value of steepest descent method. + - **double lambda** Weight parameter to balance data term and smoothness term. + - **double alpha** Parameter of spacial distribution in Bilateral-TV. + - **int btvKernelSize** Kernel size of Bilateral-TV filter. + - **int blurKernelSize** Gaussian blur kernel size. + - **double blurSigma** Gaussian blur sigma. + - **int temporalAreaRadius** Radius of the temporal search area. + - **Ptr\ opticalFlow** Dense optical flow algorithm. + */ CV_EXPORTS Ptr createSuperResolution_BTVL1(); CV_EXPORTS Ptr createSuperResolution_BTVL1_CUDA(); CV_EXPORTS Ptr createSuperResolution_BTVL1_OCL(); + +//! @} superres + } } diff --git a/modules/superres/include/opencv2/superres/optical_flow.hpp b/modules/superres/include/opencv2/superres/optical_flow.hpp index 06225e538..d4362c4fe 100644 --- a/modules/superres/include/opencv2/superres/optical_flow.hpp +++ b/modules/superres/include/opencv2/superres/optical_flow.hpp @@ -49,6 +49,10 @@ namespace cv { namespace superres { + +//! @addtogroup superres +//! @{ + class CV_EXPORTS DenseOpticalFlowExt : public cv::Algorithm { public: @@ -70,6 +74,9 @@ namespace cv CV_EXPORTS Ptr createOptFlow_PyrLK_CUDA(); CV_EXPORTS Ptr createOptFlow_PyrLK_OCL(); + +//! @} + } } diff --git a/modules/videostab/include/opencv2/videostab.hpp b/modules/videostab/include/opencv2/videostab.hpp index 3f8608943..f3dc0e4c6 100644 --- a/modules/videostab/include/opencv2/videostab.hpp +++ b/modules/videostab/include/opencv2/videostab.hpp @@ -40,15 +40,41 @@ // //M*/ -// REFERENCES -// 1. "Full-Frame Video Stabilization with Motion Inpainting" -// Yasuyuki Matsushita, Eyal Ofek, Weina Ge, Xiaoou Tang, Senior Member, and Heung-Yeung Shum -// 2. "Auto-Directed Video Stabilization with Robust L1 Optimal Camera Paths" -// Matthias Grundmann, Vivek Kwatra, Irfan Essa - #ifndef __OPENCV_VIDEOSTAB_HPP__ #define __OPENCV_VIDEOSTAB_HPP__ +/** + @defgroup videostab Video Stabilization + +The video stabilization module contains a set of functions and classes that can be used to solve the +problem of video stabilization. There are a few methods implemented, most of them are descibed in +the papers @cite OF06 and @cite G11. However, there are some extensions and deviations from the orginal +paper methods. + +### References + + 1. "Full-Frame Video Stabilization with Motion Inpainting" + Yasuyuki Matsushita, Eyal Ofek, Weina Ge, Xiaoou Tang, Senior Member, and Heung-Yeung Shum + 2. "Auto-Directed Video Stabilization with Robust L1 Optimal Camera Paths" + Matthias Grundmann, Vivek Kwatra, Irfan Essa + + @{ + @defgroup videostab_motion Global Motion Estimation + +The video stabilization module contains a set of functions and classes for global motion estimation +between point clouds or between images. In the last case features are extracted and matched +internally. For the sake of convenience the motion estimation functions are wrapped into classes. +Both the functions and the classes are available. + + @defgroup videostab_marching Fast Marching Method + +The Fast Marching Method @cite T04 is used in of the video stabilization routines to do motion and +color inpainting. The method is implemented is a flexible way and it's made public for other users. + + @} + +*/ + #include "opencv2/videostab/stabilizer.hpp" #include "opencv2/videostab/ring_buffer.hpp" diff --git a/modules/videostab/include/opencv2/videostab/deblurring.hpp b/modules/videostab/include/opencv2/videostab/deblurring.hpp index 7359f8ee3..8028c1d81 100644 --- a/modules/videostab/include/opencv2/videostab/deblurring.hpp +++ b/modules/videostab/include/opencv2/videostab/deblurring.hpp @@ -51,6 +51,9 @@ namespace cv namespace videostab { +//! @addtogroup videostab +//! @{ + CV_EXPORTS float calcBlurriness(const Mat &frame); class CV_EXPORTS DeblurerBase @@ -105,6 +108,8 @@ private: Mat_ bSum_, gSum_, rSum_, wSum_; }; +//! @} + } // namespace videostab } // namespace cv diff --git a/modules/videostab/include/opencv2/videostab/fast_marching.hpp b/modules/videostab/include/opencv2/videostab/fast_marching.hpp index b948c887c..c0c7985a7 100644 --- a/modules/videostab/include/opencv2/videostab/fast_marching.hpp +++ b/modules/videostab/include/opencv2/videostab/fast_marching.hpp @@ -53,15 +53,31 @@ namespace cv namespace videostab { -// See http://iwi.eldoc.ub.rug.nl/FILES/root/2004/JGraphToolsTelea/2004JGraphToolsTelea.pdf +//! @addtogroup videostab_marching +//! @{ + +/** @brief Describes the Fast Marching Method implementation. + + See http://iwi.eldoc.ub.rug.nl/FILES/root/2004/JGraphToolsTelea/2004JGraphToolsTelea.pdf + */ class CV_EXPORTS FastMarchingMethod { public: FastMarchingMethod() : inf_(1e6f) {} + /** @brief Template method that runs the Fast Marching Method. + + @param mask Image mask. 0 value indicates that the pixel value must be inpainted, 255 indicates + that the pixel value is known, other values aren't acceptable. + @param inpaint Inpainting functor that overloads void operator ()(int x, int y). + @return Inpainting functor. + */ template Inpaint run(const Mat &mask, Inpaint inpaint); + /** + @return Distance map that's created during working of the method. + */ Mat distanceMap() const { return dist_; } private: @@ -95,6 +111,8 @@ private: int size_; // narrow band size }; +//! @} + } // namespace videostab } // namespace cv diff --git a/modules/videostab/include/opencv2/videostab/frame_source.hpp b/modules/videostab/include/opencv2/videostab/frame_source.hpp index 0bcc3fc68..612fbdb30 100644 --- a/modules/videostab/include/opencv2/videostab/frame_source.hpp +++ b/modules/videostab/include/opencv2/videostab/frame_source.hpp @@ -51,6 +51,9 @@ namespace cv namespace videostab { +//! @addtogroup videostab +//! @{ + class CV_EXPORTS IFrameSource { public: @@ -83,6 +86,8 @@ private: Ptr impl; }; +//! @} + } // namespace videostab } // namespace cv diff --git a/modules/videostab/include/opencv2/videostab/global_motion.hpp b/modules/videostab/include/opencv2/videostab/global_motion.hpp index 494c2da78..e7248f362 100644 --- a/modules/videostab/include/opencv2/videostab/global_motion.hpp +++ b/modules/videostab/include/opencv2/videostab/global_motion.hpp @@ -61,23 +61,62 @@ namespace cv namespace videostab { +//! @addtogroup videostab_motion +//! @{ + +/** @brief Estimates best global motion between two 2D point clouds in the least-squares sense. + +@note Works in-place and changes input point arrays. + +@param points0 Source set of 2D points (32F). +@param points1 Destination set of 2D points (32F). +@param model Motion model (up to MM\_AFFINE). +@param rmse Final root-mean-square error. +@return 3x3 2D transformation matrix (32F). + */ CV_EXPORTS Mat estimateGlobalMotionLeastSquares( InputOutputArray points0, InputOutputArray points1, int model = MM_AFFINE, float *rmse = 0); +/** @brief Estimates best global motion between two 2D point clouds robustly (using RANSAC method). + +@param points0 Source set of 2D points (32F). +@param points1 Destination set of 2D points (32F). +@param model Motion model. See cv::videostab::MotionModel. +@param params RANSAC method parameters. See videostab::RansacParams. +@param rmse Final root-mean-square error. +@param ninliers Final number of inliers. + */ CV_EXPORTS Mat estimateGlobalMotionRansac( InputArray points0, InputArray points1, int model = MM_AFFINE, const RansacParams ¶ms = RansacParams::default2dMotion(MM_AFFINE), float *rmse = 0, int *ninliers = 0); +/** @brief Base class for all global motion estimation methods. + */ class CV_EXPORTS MotionEstimatorBase { public: virtual ~MotionEstimatorBase() {} + /** @brief Sets motion model. + + @param val Motion model. See cv::videostab::MotionModel. + */ virtual void setMotionModel(MotionModel val) { motionModel_ = val; } + + /** + @return Motion model. See cv::videostab::MotionModel. + */ virtual MotionModel motionModel() const { return motionModel_; } + /** @brief Estimates global motion between two 2D point clouds. + + @param points0 Source set of 2D points (32F). + @param points1 Destination set of 2D points (32F). + @param ok Indicates whether motion was estimated successfully. + @return 3x3 2D transformation matrix (32F). + */ virtual Mat estimate(InputArray points0, InputArray points1, bool *ok = 0) = 0; protected: @@ -87,6 +126,8 @@ private: MotionModel motionModel_; }; +/** @brief Describes a robust RANSAC-based global 2D motion estimation method which minimizes L2 error. + */ class CV_EXPORTS MotionEstimatorRansacL2 : public MotionEstimatorBase { public: @@ -105,6 +146,10 @@ private: float minInlierRatio_; }; +/** @brief Describes a global 2D motion estimation method which minimizes L1 error. + +@note To be able to use this method you must build OpenCV with CLP library support. : + */ class CV_EXPORTS MotionEstimatorL1 : public MotionEstimatorBase { public: @@ -125,6 +170,8 @@ private: } }; +/** @brief Base class for global 2D motion estimation methods which take frames as input. + */ class CV_EXPORTS ImageMotionEstimatorBase { public: @@ -168,6 +215,9 @@ private: Ptr motionEstimator_; }; +/** @brief Describes a global 2D motion estimation method which uses keypoints detection and optical flow for +matching. + */ class CV_EXPORTS KeypointBasedMotionEstimator : public ImageMotionEstimatorBase { public: @@ -232,8 +282,17 @@ private: #endif // defined(HAVE_OPENCV_CUDAIMGPROC) && defined(HAVE_OPENCV_CUDA) && defined(HAVE_OPENCV_CUDAOPTFLOW) +/** @brief Computes motion between two frames assuming that all the intermediate motions are known. + +@param from Source frame index. +@param to Destination frame index. +@param motions Pair-wise motions. motions[i] denotes motion from the frame i to the frame i+1 +@return Motion from the frame from to the frame to. + */ CV_EXPORTS Mat getMotion(int from, int to, const std::vector &motions); +//! @} + } // namespace videostab } // namespace cv diff --git a/modules/videostab/include/opencv2/videostab/inpainting.hpp b/modules/videostab/include/opencv2/videostab/inpainting.hpp index 402745e7e..844c68c7b 100644 --- a/modules/videostab/include/opencv2/videostab/inpainting.hpp +++ b/modules/videostab/include/opencv2/videostab/inpainting.hpp @@ -55,6 +55,9 @@ namespace cv namespace videostab { +//! @addtogroup videostab +//! @{ + class CV_EXPORTS InpainterBase { public: @@ -201,6 +204,8 @@ CV_EXPORTS void completeFrameAccordingToFlow( const Mat &flowMask, const Mat &flowX, const Mat &flowY, const Mat &frame1, const Mat &mask1, float distThresh, Mat& frame0, Mat &mask0); +//! @} + } // namespace videostab } // namespace cv diff --git a/modules/videostab/include/opencv2/videostab/log.hpp b/modules/videostab/include/opencv2/videostab/log.hpp index 9dfed5205..28625ed29 100644 --- a/modules/videostab/include/opencv2/videostab/log.hpp +++ b/modules/videostab/include/opencv2/videostab/log.hpp @@ -50,6 +50,9 @@ namespace cv namespace videostab { +//! @addtogroup videostab +//! @{ + class CV_EXPORTS ILog { public: @@ -69,6 +72,8 @@ public: virtual void print(const char *format, ...); }; +//! @} + } // namespace videostab } // namespace cv diff --git a/modules/videostab/include/opencv2/videostab/motion_core.hpp b/modules/videostab/include/opencv2/videostab/motion_core.hpp index c72e34fba..17448e3c2 100644 --- a/modules/videostab/include/opencv2/videostab/motion_core.hpp +++ b/modules/videostab/include/opencv2/videostab/motion_core.hpp @@ -51,6 +51,11 @@ namespace cv namespace videostab { +//! @addtogroup videostab_motion +//! @{ + +/** @brief Describes motion model between two point clouds. + */ enum MotionModel { MM_TRANSLATION = 0, @@ -63,22 +68,37 @@ enum MotionModel MM_UNKNOWN = 7 }; +/** @brief Describes RANSAC method parameters. + */ struct CV_EXPORTS RansacParams { - int size; // subset size - float thresh; // max error to classify as inlier - float eps; // max outliers ratio - float prob; // probability of success + int size; //!< subset size + float thresh; //!< max error to classify as inlier + float eps; //!< max outliers ratio + float prob; //!< probability of success RansacParams() : size(0), thresh(0), eps(0), prob(0) {} + /** @brief Constructor + @param size Subset size. + @param thresh Maximum re-projection error value to classify as inlier. + @param eps Maximum ratio of incorrect correspondences. + @param prob Required success probability. + */ RansacParams(int size, float thresh, float eps, float prob); + /** + @return Number of iterations that'll be performed by RANSAC method. + */ int niters() const { return static_cast( std::ceil(std::log(1 - prob) / std::log(1 - std::pow(1 - eps, size)))); } + /** + @param model Motion model. See cv::videostab::MotionModel. + @return Default RANSAC method parameters for the given motion model. + */ static RansacParams default2dMotion(MotionModel model) { CV_Assert(model < MM_UNKNOWN); @@ -101,6 +121,7 @@ struct CV_EXPORTS RansacParams inline RansacParams::RansacParams(int _size, float _thresh, float _eps, float _prob) : size(_size), thresh(_thresh), eps(_eps), prob(_prob) {} +//! @} } // namespace videostab } // namespace cv diff --git a/modules/videostab/include/opencv2/videostab/motion_stabilizing.hpp b/modules/videostab/include/opencv2/videostab/motion_stabilizing.hpp index 6b8895f0b..3bdbfbd00 100644 --- a/modules/videostab/include/opencv2/videostab/motion_stabilizing.hpp +++ b/modules/videostab/include/opencv2/videostab/motion_stabilizing.hpp @@ -53,12 +53,15 @@ namespace cv namespace videostab { +//! @addtogroup videostab_motion +//! @{ + class CV_EXPORTS IMotionStabilizer { public: virtual ~IMotionStabilizer() {} - // assumes that [0, size-1) is in or equals to [range.first, range.second) + //! assumes that [0, size-1) is in or equals to [range.first, range.second) virtual void stabilize( int size, const std::vector &motions, std::pair range, Mat *stabilizationMotions) = 0; @@ -163,6 +166,8 @@ CV_EXPORTS Mat ensureInclusionConstraint(const Mat &M, Size size, float trimRati CV_EXPORTS float estimateOptimalTrimRatio(const Mat &M, Size size); +//! @} + } // namespace videostab } // namespace diff --git a/modules/videostab/include/opencv2/videostab/optical_flow.hpp b/modules/videostab/include/opencv2/videostab/optical_flow.hpp index 4a21f9464..3898bd0e7 100644 --- a/modules/videostab/include/opencv2/videostab/optical_flow.hpp +++ b/modules/videostab/include/opencv2/videostab/optical_flow.hpp @@ -55,6 +55,9 @@ namespace cv namespace videostab { +//! @addtogroup vieostab +//! @{ + class CV_EXPORTS ISparseOptFlowEstimator { public: @@ -139,6 +142,8 @@ private: #endif +//! @} + } // namespace videostab } // namespace cv diff --git a/modules/videostab/include/opencv2/videostab/outlier_rejection.hpp b/modules/videostab/include/opencv2/videostab/outlier_rejection.hpp index a9c7578fc..09f1a8b61 100644 --- a/modules/videostab/include/opencv2/videostab/outlier_rejection.hpp +++ b/modules/videostab/include/opencv2/videostab/outlier_rejection.hpp @@ -52,6 +52,9 @@ namespace cv namespace videostab { +//! @addtogroup vieostab +//! @{ + class CV_EXPORTS IOutlierRejector { public: @@ -90,6 +93,8 @@ private: std::vector grid_; }; +//! @} + } // namespace videostab } // namespace cv diff --git a/modules/videostab/include/opencv2/videostab/ring_buffer.hpp b/modules/videostab/include/opencv2/videostab/ring_buffer.hpp index a820edef9..832690c67 100644 --- a/modules/videostab/include/opencv2/videostab/ring_buffer.hpp +++ b/modules/videostab/include/opencv2/videostab/ring_buffer.hpp @@ -51,6 +51,9 @@ namespace cv namespace videostab { +//! @addtogroup vieostab +//! @{ + template inline T& at(int idx, std::vector &items) { return items[cv::borderInterpolate(idx, static_cast(items.size()), cv::BORDER_WRAP)]; @@ -61,6 +64,8 @@ template inline const T& at(int idx, const std::vector &items) return items[cv::borderInterpolate(idx, static_cast(items.size()), cv::BORDER_WRAP)]; } +//! @} + } // namespace videostab } // namespace cv diff --git a/modules/videostab/include/opencv2/videostab/stabilizer.hpp b/modules/videostab/include/opencv2/videostab/stabilizer.hpp index b021b4798..f1a041676 100644 --- a/modules/videostab/include/opencv2/videostab/stabilizer.hpp +++ b/modules/videostab/include/opencv2/videostab/stabilizer.hpp @@ -60,6 +60,9 @@ namespace cv namespace videostab { +//! @addtogroup vieostab +//! @{ + class CV_EXPORTS StabilizerBase { public: @@ -189,6 +192,8 @@ protected: Mat suppressedFrame_; }; +//! @} + } // namespace videostab } // namespace cv diff --git a/modules/videostab/include/opencv2/videostab/wobble_suppression.hpp b/modules/videostab/include/opencv2/videostab/wobble_suppression.hpp index c95b08d0e..6eabb9ce8 100644 --- a/modules/videostab/include/opencv2/videostab/wobble_suppression.hpp +++ b/modules/videostab/include/opencv2/videostab/wobble_suppression.hpp @@ -54,6 +54,9 @@ namespace cv namespace videostab { +//! @addtogroup vieostab +//! @{ + class CV_EXPORTS WobbleSuppressorBase { public: @@ -129,6 +132,8 @@ private: }; #endif +//! @} + } // namespace videostab } // namespace cv