Doxygen documentation: shape, superres, videostab
This commit is contained in:
parent
ceb6e8bd94
commit
9d89f8d3dc
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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<HistogramCostExtractor>
|
||||
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<HistogramCostExtractor>
|
||||
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<HistogramCostExtractor> 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<HistogramCostExtractor>
|
||||
createEMDL1HistogramCostExtractor(int nDummies=25, float defaultCost=0.2f);
|
||||
|
||||
//! @}
|
||||
|
||||
} // cv
|
||||
#endif
|
||||
|
@ -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<HistogramCostExtractor> comparer) = 0;
|
||||
CV_WRAP virtual Ptr<HistogramCostExtractor> 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<ShapeTransformer> transformer) = 0;
|
||||
CV_WRAP virtual Ptr<ShapeTransformer> getTransformAlgorithm() const = 0;
|
||||
};
|
||||
@ -123,15 +189,28 @@ CV_EXPORTS_W Ptr<ShapeContextDistanceExtractor>
|
||||
/***********************************************************************************/
|
||||
/***********************************************************************************/
|
||||
/***********************************************************************************/
|
||||
/*!
|
||||
* 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<HausdorffDistanceExtractor> createHausdorffDistanceExtractor(int distanceFlag=cv::NORM_L2, float rankProp=0.6f);
|
||||
|
||||
//! @}
|
||||
|
||||
} // cv
|
||||
#endif
|
||||
|
@ -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<DMatch>& 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<ThinPlateSplineShapeTransformer>
|
||||
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<AffineTransformer> createAffineTransformer(bool fullAffine);
|
||||
|
||||
//! @}
|
||||
|
||||
} // cv
|
||||
#endif
|
||||
|
@ -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<FrameSource> 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>& 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\<DenseOpticalFlowExt\> opticalFlow** Dense optical flow algorithm.
|
||||
*/
|
||||
CV_EXPORTS Ptr<SuperResolution> createSuperResolution_BTVL1();
|
||||
CV_EXPORTS Ptr<SuperResolution> createSuperResolution_BTVL1_CUDA();
|
||||
CV_EXPORTS Ptr<SuperResolution> createSuperResolution_BTVL1_OCL();
|
||||
|
||||
//! @} superres
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<DenseOpticalFlowExt> createOptFlow_PyrLK_CUDA();
|
||||
CV_EXPORTS Ptr<DenseOpticalFlowExt> createOptFlow_PyrLK_OCL();
|
||||
|
||||
//! @}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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_<float> bSum_, gSum_, rSum_, wSum_;
|
||||
};
|
||||
|
||||
//! @}
|
||||
|
||||
} // namespace videostab
|
||||
} // namespace cv
|
||||
|
||||
|
@ -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 <typename Inpaint>
|
||||
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
|
||||
|
||||
|
@ -51,6 +51,9 @@ namespace cv
|
||||
namespace videostab
|
||||
{
|
||||
|
||||
//! @addtogroup videostab
|
||||
//! @{
|
||||
|
||||
class CV_EXPORTS IFrameSource
|
||||
{
|
||||
public:
|
||||
@ -83,6 +86,8 @@ private:
|
||||
Ptr<IFrameSource> impl;
|
||||
};
|
||||
|
||||
//! @}
|
||||
|
||||
} // namespace videostab
|
||||
} // namespace cv
|
||||
|
||||
|
@ -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<ImageMotionEstimatorBase> 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<Mat> &motions);
|
||||
|
||||
//! @}
|
||||
|
||||
} // namespace videostab
|
||||
} // namespace cv
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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<int>(
|
||||
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
|
||||
|
@ -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<Mat> &motions, std::pair<int,int> 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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -52,6 +52,9 @@ namespace cv
|
||||
namespace videostab
|
||||
{
|
||||
|
||||
//! @addtogroup vieostab
|
||||
//! @{
|
||||
|
||||
class CV_EXPORTS IOutlierRejector
|
||||
{
|
||||
public:
|
||||
@ -90,6 +93,8 @@ private:
|
||||
std::vector<Cell> grid_;
|
||||
};
|
||||
|
||||
//! @}
|
||||
|
||||
} // namespace videostab
|
||||
} // namespace cv
|
||||
|
||||
|
@ -51,6 +51,9 @@ namespace cv
|
||||
namespace videostab
|
||||
{
|
||||
|
||||
//! @addtogroup vieostab
|
||||
//! @{
|
||||
|
||||
template <typename T> inline T& at(int idx, std::vector<T> &items)
|
||||
{
|
||||
return items[cv::borderInterpolate(idx, static_cast<int>(items.size()), cv::BORDER_WRAP)];
|
||||
@ -61,6 +64,8 @@ template <typename T> inline const T& at(int idx, const std::vector<T> &items)
|
||||
return items[cv::borderInterpolate(idx, static_cast<int>(items.size()), cv::BORDER_WRAP)];
|
||||
}
|
||||
|
||||
//! @}
|
||||
|
||||
} // namespace videostab
|
||||
} // namespace cv
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user