continued cleaning up the docs and fixing hyperlinks (".. index:: <name>" and ".. _<name>:" are not needed anymore)

This commit is contained in:
Vadim Pisarevsky 2011-06-09 21:47:57 +00:00
parent 6cc3361427
commit bb8198abfd
4 changed files with 573 additions and 1131 deletions

View File

@ -103,8 +103,6 @@ The functions below use the above model to do the following:
.. index:: calibrateCamera .. index:: calibrateCamera
.. _calibrateCamera:
calibrateCamera calibrateCamera
--------------- ---------------
@ -186,8 +184,6 @@ See Also:
.. index:: calibrationMatrixValues .. index:: calibrationMatrixValues
.. _calibrationMatrixValues:
calibrationMatrixValues calibrationMatrixValues
----------------------- -----------------------
.. cpp:function:: void calibrationMatrixValues( InputArray cameraMatrix, Size imageSize, double apertureWidth, double apertureHeight, double& fovx, double& fovy, double& focalLength, Point2d& principalPoint, double& aspectRatio ) .. cpp:function:: void calibrationMatrixValues( InputArray cameraMatrix, Size imageSize, double apertureWidth, double apertureHeight, double& fovx, double& fovy, double& focalLength, Point2d& principalPoint, double& aspectRatio )
@ -216,8 +212,6 @@ The function computes various useful camera characteristics from the previously
.. index:: composeRT .. index:: composeRT
.. _composeRT:
composeRT composeRT
------------- -------------
@ -253,8 +247,6 @@ The functions are used inside :ref:`stereoCalibrate` but can also be used in you
.. index:: computeCorrespondEpilines .. index:: computeCorrespondEpilines
.. _computeCorrespondEpilines:
computeCorrespondEpilines computeCorrespondEpilines
----------------------------- -----------------------------
.. cpp:function:: void computeCorrespondEpilines( InputArray points, int whichImage, InputArray F, OutputArray lines ) .. cpp:function:: void computeCorrespondEpilines( InputArray points, int whichImage, InputArray F, OutputArray lines )
@ -374,8 +366,6 @@ The function is based on
.. index:: drawChessboardCorners .. index:: drawChessboardCorners
.. _drawChessboardCorners:
drawChessboardCorners drawChessboardCorners
------------------------- -------------------------
.. cpp:function:: void drawChessboardCorners( InputOutputArray image, Size patternSize, InputArray corners, bool patternWasFound ) .. cpp:function:: void drawChessboardCorners( InputOutputArray image, Size patternSize, InputArray corners, bool patternWasFound )
@ -384,18 +374,16 @@ drawChessboardCorners
:param image: Destination image. It must be an 8-bit color image. :param image: Destination image. It must be an 8-bit color image.
:param patternSize: Number of inner corners per a chessboard row and column. ``(patternSize = cv::Size(points_per_row,points_per_column) = cv::Size(rows,columns) )`` :param patternSize: Number of inner corners per a chessboard row and column ``(patternSize = cv::Size(points_per_row,points_per_column))``
:param corners: Array of detected corners. This should be an output from ``findChessboardCorners`` wrapped in ``cv::Mat()`` . :param corners: Array of detected corners, the output of ``findChessboardCorners``.
:param patternWasFound: Parameter indicating whether the complete board was found or not. The return value :ref:`FindChessboardCorners` may be passed here. :param patternWasFound: Parameter indicating whether the complete board was found or not. The return value of :cpp:func:`findChessboardCorners` should be passed here.
The function draws individual chessboard corners detected either as red circles if the board was not found, or as colored corners connected with lines if the board was found. The function draws individual chessboard corners detected either as red circles if the board was not found, or as colored corners connected with lines if the board was found.
.. index:: findChessboardCorners .. index:: findChessboardCorners
.. _findChessboardCorners:
findChessboardCorners findChessboardCorners
------------------------- -------------------------
.. cpp:function:: bool findChessboardCorners( InputArray image, Size patternSize, OutputArray corners, int flags=CV_CALIB_CB_ADAPTIVE_THRESH+CV_CALIB_CB_NORMALIZE_IMAGE ) .. cpp:function:: bool findChessboardCorners( InputArray image, Size patternSize, OutputArray corners, int flags=CV_CALIB_CB_ADAPTIVE_THRESH+CV_CALIB_CB_NORMALIZE_IMAGE )
@ -454,8 +442,6 @@ The function requires white space (like a square-thick border, the wider the bet
.. index:: findCirclesGrid .. index:: findCirclesGrid
.. _findCirclesGrid:
findCirclesGrid findCirclesGrid
------------------- -------------------
.. cpp:function:: bool findCirclesGrid( InputArray image, Size patternSize, OutputArray centers, int flags=CALIB_CB_SYMMETRIC_GRID, const Ptr<FeatureDetector> &blobDetector = new SimpleBlobDetector() ) .. cpp:function:: bool findCirclesGrid( InputArray image, Size patternSize, OutputArray centers, int flags=CALIB_CB_SYMMETRIC_GRID, const Ptr<FeatureDetector> &blobDetector = new SimpleBlobDetector() )
@ -501,8 +487,6 @@ The function requires white space (like a square-thick border, the wider the bet
.. index:: solvePnP .. index:: solvePnP
.. _solvePnP:
solvePnP solvePnP
------------ ------------
.. cpp:function:: void solvePnP( InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess=false ) .. cpp:function:: void solvePnP( InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess=false )
@ -528,8 +512,6 @@ The function estimates the object pose given a set of object points, their corre
.. index:: solvePnPRansac .. index:: solvePnPRansac
.. _solvePnPRansac:
solvePnPRansac solvePnPRansac
------------------ ------------------
@ -564,8 +546,6 @@ The function estimates an object pose given a set of object points, their corres
.. index:: findFundamentalMat .. index:: findFundamentalMat
.. _findFundamentalMat:
findFundamentalMat findFundamentalMat
---------------------- ----------------------
.. cpp:function:: Mat findFundamentalMat( InputArray points1, InputArray points2, int method=FM_RANSAC, double param1=3., double param2=0.99, OutputArray mask=noArray() ) .. cpp:function:: Mat findFundamentalMat( InputArray points1, InputArray points2, int method=FM_RANSAC, double param1=3., double param2=0.99, OutputArray mask=noArray() )
@ -755,8 +735,6 @@ the optimal new camera matrix based on the free scaling parameter. By varying t
.. index:: initCameraMatrix2D .. index:: initCameraMatrix2D
.. _initCameraMatrix2D:
initCameraMatrix2D initCameraMatrix2D
---------------------- ----------------------
.. cpp:function:: Mat initCameraMatrix2D( InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, Size imageSize, double aspectRatio=1.) .. cpp:function:: Mat initCameraMatrix2D( InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, Size imageSize, double aspectRatio=1.)
@ -776,8 +754,6 @@ Currently, the function only supports planar calibration patterns, which are pat
.. index:: matMulDeriv .. index:: matMulDeriv
.. _matMulDeriv:
matMulDeriv matMulDeriv
--------------- ---------------
@ -799,8 +775,6 @@ The function computes partial derivatives of the elements of the matrix product
.. index:: projectPoints .. index:: projectPoints
.. _projectPoints:
projectPoints projectPoints
----------------- -----------------
@ -843,8 +817,6 @@ By setting ``rvec=tvec=(0,0,0)`` or by setting ``cameraMatrix`` to a 3x3 identi
.. index:: reprojectImageTo3D .. index:: reprojectImageTo3D
.. _reprojectImageTo3D:
reprojectImageTo3D reprojectImageTo3D
---------------------- ----------------------
@ -903,8 +875,6 @@ that could be used in OpenGL.
.. index:: Rodrigues .. index:: Rodrigues
.. _Rodrigues:
Rodrigues Rodrigues
------------- -------------
.. cpp:function:: void Rodrigues(InputArray src, OutputArray dst, OutputArray jacobian=noArray()) .. cpp:function:: void Rodrigues(InputArray src, OutputArray dst, OutputArray jacobian=noArray())
@ -936,8 +906,6 @@ used in the global 3D geometry optimization procedures like
.. index:: StereoBM .. index:: StereoBM
.. _StereoBM:
StereoBM StereoBM
-------- --------
.. c:type:: StereoBM .. c:type:: StereoBM
@ -973,8 +941,6 @@ The class is a C++ wrapper for the associated functions. In particular, ``Stereo
.. index:: StereoBM::operator () .. index:: StereoBM::operator ()
.. _StereoBM::operator ():
StereoBM::operator () StereoBM::operator ()
----------------------- -----------------------
@ -995,8 +961,6 @@ The method executes the BM algorithm on a rectified stereo pair. See the ``stere
.. index:: StereoSGBM .. index:: StereoSGBM
.. _StereoSGBM:
StereoSGBM StereoSGBM
---------- ----------
@ -1042,8 +1006,6 @@ The class implements the modified H. Hirschmuller algorithm HH08 that differs fr
.. index:: StereoSGBM::StereoSGBM .. index:: StereoSGBM::StereoSGBM
.. _StereoSGBM::StereoSGBM:
StereoSGBM::StereoSGBM StereoSGBM::StereoSGBM
-------------------------- --------------------------
.. cpp:function:: StereoSGBM::StereoSGBM() .. cpp:function:: StereoSGBM::StereoSGBM()
@ -1076,8 +1038,6 @@ The first constructor initializes ``StereoSGBM`` with all the default parameters
.. index:: StereoSGBM::operator () .. index:: StereoSGBM::operator ()
.. _StereoSGBM::operator ():
StereoSGBM::operator () StereoSGBM::operator ()
----------------------- -----------------------
@ -1099,8 +1059,6 @@ The method is not constant, so you should not use the same ``StereoSGBM`` instan
.. index:: stereoCalibrate .. index:: stereoCalibrate
.. _stereoCalibrate:
stereoCalibrate stereoCalibrate
------------------- -------------------
.. cpp:function:: double stereoCalibrate( InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2, InputOutputArray cameraMatrix1, InputOutputArray distCoeffs1, InputOutputArray cameraMatrix2, InputOutputArray distCoeffs2, Size imageSize, OutputArray R, OutputArray T, OutputArray E, OutputArray F, TermCriteria term_crit = TermCriteria(TermCriteria::COUNT+ TermCriteria::EPS, 30, 1e-6), int flags=CALIB_FIX_INTRINSIC ) .. cpp:function:: double stereoCalibrate( InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2, InputOutputArray cameraMatrix1, InputOutputArray distCoeffs1, InputOutputArray cameraMatrix2, InputOutputArray distCoeffs2, Size imageSize, OutputArray R, OutputArray T, OutputArray E, OutputArray F, TermCriteria term_crit = TermCriteria(TermCriteria::COUNT+ TermCriteria::EPS, 30, 1e-6), int flags=CALIB_FIX_INTRINSIC )
@ -1265,8 +1223,6 @@ See below the screenshot from the ``stereo_calib.cpp`` sample. Some red horizont
.. index:: stereoRectifyUncalibrated .. index:: stereoRectifyUncalibrated
.. _stereoRectifyUncalibrated:
stereoRectifyUncalibrated stereoRectifyUncalibrated
----------------------------- -----------------------------
.. cpp:function:: bool stereoRectifyUncalibrated( InputArray points1, InputArray points2, InputArray F, Size imgSize, OutputArray H1, OutputArray H2, double threshold=5 ) .. cpp:function:: bool stereoRectifyUncalibrated( InputArray points1, InputArray points2, InputArray F, Size imgSize, OutputArray H1, OutputArray H2, double threshold=5 )

View File

@ -3,42 +3,12 @@ Basic Structures
.. highlight:: cpp .. highlight:: cpp
.. index:: _DataType
.. _DataType:
DataType DataType
-------- --------
.. cpp:class:: DataType .. cpp:class:: DataType
Template "trait" class for other OpenCV primitive data types :: - Template "trait" class for other OpenCV primitive data types. A primitive OpenCV data type is one of ``unsigned char``, ``bool``, ``signed char``, ``unsigned short``, ``signed short``, ``int``, ``float``, ``double`` or a tuple of values of one of these types, where all the values in the tuple have the same type. Any primitive type from the list can be defined by an identifier in the form ``CV_<bit-depth>{U|S|F}C(<number_of_channels>)``, for example: ``uchar`` ~ ``CV_8UC1``, 3-element floating-point tuple ~ ``CV_32FC3``, and so on. A universal OpenCV structure that is able to store a single instance of such a primitive data type is
template<typename _Tp> class DataType
{
// value_type is always a synonym to _Tp.
typedef _Tp value_type;
// intermediate type used for operations on _Tp.
// it is int for uchar, signed char, unsigned short, signed short, and int,
// float for float, double for double, ...
typedef <...> work_type;
// in the case of multi-channel data, it is the data type of each channel
typedef <...> channel_type;
enum
{
// CV_8U ... CV_64F
depth = DataDepth<channel_type>::value,
// 1 ...
channels = <...>,
// '1u', '4i', '3f', '2d' etc.
fmt=<...>,
// CV_8UC3, CV_32FC2 ...
type = CV_MAKETYPE(depth, channels)
};
};
The template class ``DataType`` is a descriptive class for OpenCV primitive data types and other types that comply with the following definition. A primitive OpenCV data type is one of ``unsigned char``, ``bool``, ``signed char``, ``unsigned short``, ``signed short``, ``int``, ``float``, ``double`` or a tuple of values of one of these types, where all the values in the tuple have the same type. Any primitive type from the list can be defined by an identifier in the form ``CV_<bit-depth>{U|S|F}C(<number_of_channels>)``, for example: ``uchar`` ~ ``CV_8UC1``, 3-element floating-point tuple ~ ``CV_32FC3``, and so on. A universal OpenCV structure that is able to store a single instance of such a primitive data type is
:ref:`Vec`. Multiple instances of such a type can be stored in a ``std::vector``, ``Mat``, ``Mat_``, ``SparseMat``, ``SparseMat_``, or any other container that is able to store ``Vec`` instances. :ref:`Vec`. Multiple instances of such a type can be stored in a ``std::vector``, ``Mat``, ``Mat_``, ``SparseMat``, ``SparseMat_``, or any other container that is able to store ``Vec`` instances.
The ``DataType`` class is basically used to provide a description of such primitive data types without adding any fields or methods to the corresponding classes (and it is actually impossible to add anything to primitive C/C++ data types). This technique is known in C++ as class traits. It is not ``DataType`` itself that is used but its specialized versions, such as: :: The ``DataType`` class is basically used to provide a description of such primitive data types without adding any fields or methods to the corresponding classes (and it is actually impossible to add anything to primitive C/C++ data types). This technique is known in C++ as class traits. It is not ``DataType`` itself that is used but its specialized versions, such as: ::
@ -75,44 +45,12 @@ The main purpose of this class is to convert compilation-time type information t
So, such traits are used to tell OpenCV which data type you are working with, even if such a type is not native to OpenCV. For example, the matrix ``B`` intialization above is compiled because OpenCV defines the proper specialized template class ``DataType<complex<_Tp> >`` . This mechanism is also useful (and used in OpenCV this way) for generic algorithms implementations. So, such traits are used to tell OpenCV which data type you are working with, even if such a type is not native to OpenCV. For example, the matrix ``B`` intialization above is compiled because OpenCV defines the proper specialized template class ``DataType<complex<_Tp> >`` . This mechanism is also useful (and used in OpenCV this way) for generic algorithms implementations.
.. index:: Point\_
Point\_ Point\_
------- -------
.. cpp:class:: Point_ .. cpp:class:: Point_
Template class for 2D points :: Template class for 2D points, specified by its coordinates
template<typename _Tp> class Point_
{
public:
typedef _Tp value_type;
Point_();
Point_(_Tp _x, _Tp _y);
Point_(const Point_& pt);
Point_(const CvPoint& pt);
Point_(const CvPoint2D32f& pt);
Point_(const Size_<_Tp>& sz);
Point_(const Vec<_Tp, 2>& v);
Point_& operator = (const Point_& pt);
template<typename _Tp2> operator Point_<_Tp2>() const;
operator CvPoint() const;
operator CvPoint2D32f() const;
operator Vec<_Tp, 2>() const;
// computes dot-product (this->x*pt.x + this->y*pt.y)
_Tp dot(const Point_& pt) const;
// computes dot-product using double-precision arithmetics
double ddot(const Point_& pt) const;
// returns true if the point is inside the rectangle "r".
bool inside(const Rect_<_Tp>& r) const;
_Tp x, y;
};
The class represents a 2D point specified by its coordinates
:math:`x` and :math:`x` and
:math:`y` . :math:`y` .
An instance of the class is interchangeable with C structures, ``CvPoint`` and ``CvPoint2D32f`` . There is also a cast operator to convert point coordinates to the specified type. The conversion from floating-point coordinates to integer coordinates is done by rounding. Commonly, the conversion uses this An instance of the class is interchangeable with C structures, ``CvPoint`` and ``CvPoint2D32f`` . There is also a cast operator to convert point coordinates to the specified type. The conversion from floating-point coordinates to integer coordinates is done by rounding. Commonly, the conversion uses this
@ -142,39 +80,12 @@ Example: ::
Point pt = (a + b)*10.f; Point pt = (a + b)*10.f;
cout << pt.x << ", " << pt.y << endl; cout << pt.x << ", " << pt.y << endl;
.. index:: Point3\_
Point3\_ Point3\_
-------- --------
.. cpp:class:: Point3_ .. cpp:class:: Point3_
Template class for 3D points :: Template class for 3D points, specified by its coordinates
template<typename _Tp> class Point3_
{
public:
typedef _Tp value_type;
Point3_();
Point3_(_Tp _x, _Tp _y, _Tp _z);
Point3_(const Point3_& pt);
explicit Point3_(const Point_<_Tp>& pt);
Point3_(const CvPoint3D32f& pt);
Point3_(const Vec<_Tp, 3>& v);
Point3_& operator = (const Point3_& pt);
template<typename _Tp2> operator Point3_<_Tp2>() const;
operator CvPoint3D32f() const;
operator Vec<_Tp, 3>() const;
_Tp dot(const Point3_& pt) const;
double ddot(const Point3_& pt) const;
_Tp x, y, z;
};
The class represents a 3D point specified by its coordinates
:math:`x`, :math:`x`,
:math:`y` and :math:`y` and
:math:`z` . :math:`z` .
@ -186,40 +97,12 @@ The following ``Point3_<>`` aliases are available: ::
typedef Point3_<float> Point3f; typedef Point3_<float> Point3f;
typedef Point3_<double> Point3d; typedef Point3_<double> Point3d;
.. index:: Size\_
Size\_ Size\_
------ ------
.. cpp:class:: Size_ .. cpp:class:: Size_
Template class for specfying an image or rectangle size :: Template class for specfying size of an image or rectangle. The class includes two members are called ``width`` and ``height``. The structure can be converted to and from the old OpenCV structures
template<typename _Tp> class Size_
{
public:
typedef _Tp value_type;
Size_();
Size_(_Tp _width, _Tp _height);
Size_(const Size_& sz);
Size_(const CvSize& sz);
Size_(const CvSize2D32f& sz);
Size_(const Point_<_Tp>& pt);
Size_& operator = (const Size_& sz);
_Tp area() const;
operator Size_<int>() const;
operator Size_<float>() const;
operator Size_<double>() const;
operator CvSize() const;
operator CvSize2D32f() const;
_Tp width, height;
};
The class ``Size_`` is similar to ``Point_`` except that the two members are called ``width`` and ``height`` instead of ``x`` and ``y`` . The structure can be converted to and from the old OpenCV structures
``CvSize`` and ``CvSize2D32f`` . The same set of arithmetic and comparison operations as for ``Point_`` is available. ``CvSize`` and ``CvSize2D32f`` . The same set of arithmetic and comparison operations as for ``Point_`` is available.
OpenCV defines the following ``Size_<>`` aliases: :: OpenCV defines the following ``Size_<>`` aliases: ::
@ -228,53 +111,12 @@ OpenCV defines the following ``Size_<>`` aliases: ::
typedef Size2i Size; typedef Size2i Size;
typedef Size_<float> Size2f; typedef Size_<float> Size2f;
.. index:: Rect\_
Rect\_ Rect\_
------ ------
.. cpp:class:: Rect_ .. cpp:class:: Rect_
Template class for 2D rectangles :: Template class for 2D rectangles, described by the following parameters::
template<typename _Tp> class Rect_
{
public:
typedef _Tp value_type;
Rect_();
Rect_(_Tp _x, _Tp _y, _Tp _width, _Tp _height);
Rect_(const Rect_& r);
Rect_(const CvRect& r);
// (x, y) <- org, (width, height) <- sz
Rect_(const Point_<_Tp>& org, const Size_<_Tp>& sz);
// (x, y) <- min(pt1, pt2), (width, height) <- max(pt1, pt2) - (x, y)
Rect_(const Point_<_Tp>& pt1, const Point_<_Tp>& pt2);
Rect_& operator = ( const Rect_& r );
// returns Point_<_Tp>(x, y)
Point_<_Tp> tl() const;
// returns Point_<_Tp>(x+width, y+height)
Point_<_Tp> br() const;
// returns Size_<_Tp>(width, height)
Size_<_Tp> size() const;
// returns width*height
_Tp area() const;
operator Rect_<int>() const;
operator Rect_<float>() const;
operator Rect_<double>() const;
operator CvRect() const;
// x <= pt.x && pt.x < x + width &&
// y <= pt.y && pt.y < y + height ? true : false
bool contains(const Point_<_Tp>& pt) const;
_Tp x, y, width, height;
};
The rectangle is described with the following parameters:
* Coordinates of the top-left corner. This is a default interpretation of ``Rect_::x`` and ``Rect_::y`` in OpenCV. Though, in your algorithms you may count ``x`` and ``y`` from the bottom-left corner. * Coordinates of the top-left corner. This is a default interpretation of ``Rect_::x`` and ``Rect_::y`` in OpenCV. Though, in your algorithms you may count ``x`` and ``y`` from the bottom-left corner.
* Rectangle width and height. * Rectangle width and height.
@ -328,99 +170,29 @@ For your convenience, the ``Rect_<>`` alias is available: ::
typedef Rect_<int> Rect; typedef Rect_<int> Rect;
.. index:: _RotatedRect
.. _RotatedRect:
RotatedRect RotatedRect
----------- -----------
.. cpp:class:: RotatedRect .. cpp:class:: RotatedRect
Template class for rotated rectangles :: Template class for rotated rectangles that are specified by the center, size and the rotation angle in degrees.
class RotatedRect
{
public:
// constructors
RotatedRect();
RotatedRect(const Point2f& _center, const Size2f& _size, float _angle);
RotatedRect(const CvBox2D& box);
// returns minimal up-right rectangle that contains the rotated rectangle
Rect boundingRect() const;
// backward conversion to CvBox2D
operator CvBox2D() const;
// mass center of the rectangle
Point2f center;
// size
Size2f size;
// rotation angle in degrees
float angle;
};
The class ``RotatedRect`` replaces the old ``CvBox2D`` and is fully compatible with it.
.. index:: TermCriteria
TermCriteria TermCriteria
------------ ------------
.. cpp:class:: TermCriteria .. cpp:class:: TermCriteria
Template class defining termination criteria for iterative algorithms :: Template class defining termination criteria for iterative algorithms
class TermCriteria
{
public:
enum { COUNT=1, MAX_ITER=COUNT, EPS=2 };
// constructors
TermCriteria();
// type can be MAX_ITER, EPS or MAX_ITER+EPS.
// type = MAX_ITER means that only the number of iterations does matter;
// type = EPS means that only the required precision (epsilon) does matter
// (though, most algorithms limit the number of iterations anyway)
// type = MAX_ITER + EPS means that algorithm stops when
// either the specified number of iterations is made,
// or when the specified accuracy is achieved - whatever happens first.
TermCriteria(int _type, int _maxCount, double _epsilon);
TermCriteria(const CvTermCriteria& criteria);
operator CvTermCriteria() const;
int type;
int maxCount;
double epsilon;
};
The class ``TermCriteria`` replaces the old ``CvTermCriteria`` and is fully compatible with it.
.. index:: Matx
.. _Matx:
Matx Matx
---- ----
.. cpp:class:: Matx .. cpp:class:: Matx
Template class for small matrices :: Template class for small matrices, whose type and size are known at compilation time.: ::
template<typename T, int m, int n> class Matx template<typename _Tp, int m, int n> class Matx {...};
{
public:
typedef T value_type;
enum { depth = DataDepth<T>::value, channels = m*n,
type = CV_MAKETYPE(depth, channels) };
// various methods
...
Tp val[m*n];
};
typedef Matx<float, 1, 2> Matx12f; typedef Matx<float, 1, 2> Matx12f;
typedef Matx<double, 1, 2> Matx12d; typedef Matx<double, 1, 2> Matx12d;
@ -440,9 +212,7 @@ Template class for small matrices ::
typedef Matx<float, 6, 6> Matx66f; typedef Matx<float, 6, 6> Matx66f;
typedef Matx<double, 6, 6> Matx66d; typedef Matx<double, 6, 6> Matx66d;
If you need a more flexible type, use :cpp:class:`Mat` . The elements of the matrix ``M`` are accessible using the ``M(i,j)`` notation. Most of the common matrix operations (see also
The class represents small matrices whose type and size are known at compilation time. If you need a more flexible type, use
:cpp:class:`Mat` . The elements of the matrix ``M`` are accessible using the ``M(i,j)`` notation. Most of the common matrix operations (see also
:ref:`MatrixExpressions` ) are available. To do an operation on ``Matx`` that is not implemented, you can easily convert the matrix to :ref:`MatrixExpressions` ) are available. To do an operation on ``Matx`` that is not implemented, you can easily convert the matrix to
:cpp:class:`Mat` and backwards. :: :cpp:class:`Mat` and backwards. ::
@ -451,26 +221,15 @@ The class represents small matrices whose type and size are known at compilation
7, 8, 9); 7, 8, 9);
cout << sum(Mat(m*m.t())) << endl; cout << sum(Mat(m*m.t())) << endl;
.. index:: Vec
.. _Vec:
Vec Vec
--- ---
.. cpp:class:: Vec .. cpp:class:: Vec
Template class for short numerical vectors :: Template class for short numerical vectors, a partial case of :cpp:class:`Matx`: ::
template<typename T, int cn> class Vec : public Matx<T, cn, 1> template<typename _Tp, int n> class Vec : public Matx<_Tp, n, 1> {...};
{
public:
typedef T value_type;
enum { depth = DataDepth<T>::value, channels = cn,
type = CV_MAKETYPE(depth, channels) };
// various methods ...
};
typedef Vec<uchar, 2> Vec2b; typedef Vec<uchar, 2> Vec2b;
typedef Vec<uchar, 3> Vec3b; typedef Vec<uchar, 3> Vec3b;
@ -494,78 +253,50 @@ Template class for short numerical vectors ::
typedef Vec<double, 4> Vec4d; typedef Vec<double, 4> Vec4d;
typedef Vec<double, 6> Vec6d; typedef Vec<double, 6> Vec6d;
``Vec`` is a partial case of ``Matx`` . It is possible to convert ``Vec<T,2>`` to/from ``Point_``, ``Vec<T,3>`` to/from ``Point3_`` , and ``Vec<T,4>`` to ``CvScalar`` or :ref:`Scalar`. The elements of ``Vec`` are accessed using ``operator[]``. All the expected vector operations are implemented too: It is possible to convert ``Vec<T,2>`` to/from ``Point_``, ``Vec<T,3>`` to/from ``Point3_`` , and ``Vec<T,4>`` to ``CvScalar`` or :ref:`Scalar`. The elements of ``Vec`` are accessed using ``operator[]``.
* All the expected vector operations are implemented too:
:math:`\texttt{v1} = \texttt{v2} \pm \texttt{v3}`, :math:`\texttt{v1} = \texttt{v2} * \alpha`, :math:`\texttt{v1} = \alpha * \texttt{v2}` in addition to the corresponding augmenting operations. Note that these operations apply
to each computed vector component.
* ``v1 == v2, v1 != v2`` * ``norm(v1)`` (:math:`L_2`-norm) * ``v1 = v2 + v3``
* ``v1 = v2 - v3``
* ``v1 = v2 * scale``
* ``v1 = scale * v2``
* ``v1 = -v2``
* ``v1 += v2`` and other augmenting operations.
* ``v1 == v2, v1 != v2``
* ``norm(v1)`` (euclidean norm)
The ``Vec`` class is commonly used to describe pixel types of multi-channel arrays. See The ``Vec`` class is commonly used to describe pixel types of multi-channel arrays. See :cpp:class:`Mat` for details.
:ref:`Mat_` for details.
.. index:: Scalar
.. _Scalar:
Scalar\_ Scalar\_
-------- --------
.. cpp:class:: Scalar_ .. cpp:class:: Scalar_
Template class for a 4-element vector :: Template class for a 4-element vector, derived from Vec ::
template<typename _Tp> class Scalar_ : public Vec<_Tp, 4> template<typename _Tp> class Scalar_ : public Vec<_Tp, 4> { ... };
{
public:
Scalar_();
Scalar_(_Tp v0, _Tp v1, _Tp v2=0, _Tp v3=0);
Scalar_(const CvScalar& s);
Scalar_(_Tp v0);
static Scalar_<_Tp> all(_Tp v0);
operator CvScalar() const;
template<typename T2> operator Scalar_<T2>() const;
Scalar_<_Tp> mul(const Scalar_<_Tp>& t, double scale=1 ) const;
template<typename T2> void convertTo(T2* buf, int channels, int unroll_to=0) const;
};
typedef Scalar_<double> Scalar; typedef Scalar_<double> Scalar;
Being derived from ``Vec<_Tp, 4>`` , ``Scalar_`` and ``Scalar`` can be used just as typical 4-element vectors. In addition, they can be converted to/from ``CvScalar`` . The type ``Scalar`` is widely used in OpenCV for passing pixel values.
The template class ``Scalar_`` and its double-precision instantiation ``Scalar`` represent a 4-element vector. Being derived from ``Vec<_Tp, 4>`` , they can be used as typical 4-element vectors. In addition, they can be converted to/from ``CvScalar`` . The type ``Scalar`` is widely used in OpenCV for passing pixel values. It is a drop-in replacement for
``CvScalar`` that was used for the same purpose in the earlier versions of OpenCV.
.. index:: Range
.. _Range:
Range Range
----- -----
.. cpp:class:: Range .. cpp:class:: Range
Template class specifying a continuous subsequence (slice) of a sequence :: Template class specifying a continuous subsequence (slice) of a sequence. ::
class Range class Range
{ {
public: public:
Range(); ...
Range(int _start, int _end);
Range(const CvSlice& slice);
int size() const;
bool empty() const;
static Range all();
operator CvSlice() const;
int start, end; int start, end;
}; };
The class is used to specify a row or a column span in a matrix ( The class is used to specify a row or a column span in a matrix (
:ref:`Mat` ) and for many other purposes. ``Range(a,b)`` is basically the same as ``a:b`` in Matlab or ``a..b`` in Python. As in Python, ``start`` is an inclusive left boundary of the range and ``end`` is an exclusive right boundary of the range. Such a half-opened interval is usually denoted as :cpp:class:`Mat` ) and for many other purposes. ``Range(a,b)`` is basically the same as ``a:b`` in Matlab or ``a..b`` in Python. As in Python, ``start`` is an inclusive left boundary of the range and ``end`` is an exclusive right boundary of the range. Such a half-opened interval is usually denoted as
:math:`[start,end)` . :math:`[start,end)` .
The static method ``Range::all()`` returns a special variable that means "the whole sequence" or "the whole range", just like " ``:`` " in Matlab or " ``...`` " in Python. All the methods and functions in OpenCV that take ``Range`` support this special ``Range::all()`` value. But, of course, in case of your own custom processing, you will probably have to check and handle it explicitly: :: The static method ``Range::all()`` returns a special variable that means "the whole sequence" or "the whole range", just like " ``:`` " in Matlab or " ``...`` " in Python. All the methods and functions in OpenCV that take ``Range`` support this special ``Range::all()`` value. But, of course, in case of your own custom processing, you will probably have to check and handle it explicitly: ::
@ -581,10 +312,6 @@ The static method ``Range::all()`` returns a special variable that means "the wh
} }
.. index:: Ptr
.. _Ptr:
Ptr Ptr
--- ---
@ -1870,10 +1597,6 @@ Mat::type
The method returns a matrix element type. This is an id, compatible with the ``CvMat`` type system, like ``CV_16SC3`` or 16-bit signed 3-channel array, and so on. The method returns a matrix element type. This is an id, compatible with the ``CvMat`` type system, like ``CV_16SC3`` or 16-bit signed 3-channel array, and so on.
.. index:: Mat::depth
.. _Mat::depth:
Mat::depth Mat::depth
-------------- --------------
.. cpp:function:: int Mat::depth() const .. cpp:function:: int Mat::depth() const
@ -1896,10 +1619,6 @@ The method returns the matrix element depth id (the type of each individual chan
* ``CV_64F`` - 64-bit floating-point numbers ( ``-DBL_MAX..DBL_MAX, INF, NAN`` ) * ``CV_64F`` - 64-bit floating-point numbers ( ``-DBL_MAX..DBL_MAX, INF, NAN`` )
.. index:: Mat::channels
.. _Mat::channels:
Mat::channels Mat::channels
----------------- -----------------
.. cpp:function:: int Mat::channels() const .. cpp:function:: int Mat::channels() const
@ -1908,10 +1627,6 @@ Mat::channels
The method returns the number of matrix channels. The method returns the number of matrix channels.
.. index:: Mat::step1
.. _Mat::step1:
Mat::step1 Mat::step1
-------------- --------------
.. cpp:function:: size_t Mat::step1() const .. cpp:function:: size_t Mat::step1() const
@ -1921,8 +1636,6 @@ Mat::step1
The method returns a matrix step divided by The method returns a matrix step divided by
:cpp:func:`Mat::elemSize1()` . It can be useful to quickly access an arbitrary matrix element. :cpp:func:`Mat::elemSize1()` . It can be useful to quickly access an arbitrary matrix element.
.. index:: Mat::size
Mat::size Mat::size
------------- -------------
.. cpp:function:: Size Mat::size() const .. cpp:function:: Size Mat::size() const
@ -1931,10 +1644,6 @@ Mat::size
The method returns a matrix size: ``Size(cols, rows)`` . The method returns a matrix size: ``Size(cols, rows)`` .
.. index:: Mat::empty
.. _Mat::empty:
Mat::empty Mat::empty
-------------- --------------
.. cpp:function:: bool Mat::empty() const .. cpp:function:: bool Mat::empty() const
@ -1943,10 +1652,6 @@ Mat::empty
The method returns ``true`` if ``Mat::total()`` is 0 or if ``Mat::data`` is NULL. Because of ``pop_back()`` and ``resize()`` methods ``M.total() == 0`` does not imply that ``M.data == NULL`` . The method returns ``true`` if ``Mat::total()`` is 0 or if ``Mat::data`` is NULL. Because of ``pop_back()`` and ``resize()`` methods ``M.total() == 0`` does not imply that ``M.data == NULL`` .
.. index:: Mat::ptr
.. _Mat::ptr:
Mat::ptr Mat::ptr
------------ ------------
.. cpp:function:: uchar* Mat::ptr(int i=0) .. cpp:function:: uchar* Mat::ptr(int i=0)
@ -1964,10 +1669,6 @@ Mat::ptr
The methods return ``uchar*`` or typed pointer to the specified matrix row. See the sample in The methods return ``uchar*`` or typed pointer to the specified matrix row. See the sample in
:cpp:func:`Mat::isContinuous` () to know how to use these methods. :cpp:func:`Mat::isContinuous` () to know how to use these methods.
.. index:: Mat::at
.. _Mat::at:
Mat::at Mat::at
----------- -----------
.. cpp:function:: template<typename T> T& Mat::at(int i) const .. cpp:function:: template<typename T> T& Mat::at(int i) const
@ -2010,10 +1711,6 @@ Here is an example of initialization of a Hilbert matrix: ::
H.at<double>(i,j)=1./(i+j+1); H.at<double>(i,j)=1./(i+j+1);
.. index:: Mat::begin
.. _Mat::begin:
Mat::begin Mat::begin
-------------- --------------
.. cpp:function:: template<typename _Tp> MatIterator_<_Tp> Mat::begin() template<typename _Tp> MatConstIterator_<_Tp> Mat::begin() const .. cpp:function:: template<typename _Tp> MatIterator_<_Tp> Mat::begin() template<typename _Tp> MatConstIterator_<_Tp> Mat::begin() const
@ -2052,10 +1749,6 @@ The methods return the matrix read-only or read-write iterators. The use of matr
} }
.. index:: Mat::end
.. _Mat::end:
Mat::end Mat::end
------------ ------------
.. cpp:function:: template<typename _Tp> MatIterator_<_Tp> Mat::end() .. cpp:function:: template<typename _Tp> MatIterator_<_Tp> Mat::end()
@ -2114,8 +1807,6 @@ To use ``Mat_`` for multi-channel images/matrices, pass ``Vec`` as a ``Mat_`` pa
img(i,j)[2] ^= (uchar)(i ^ j); img(i,j)[2] ^= (uchar)(i ^ j);
.. _NAryMatIterator:
NAryMatIterator NAryMatIterator
--------------- ---------------
@ -2186,8 +1877,6 @@ Here is an example of how you can compute a normalized and thresholded 3D color
} }
.. index:: SparseMat
SparseMat SparseMat
--------- ---------
@ -2469,8 +2158,6 @@ The class ``SparseMat`` represents multi-dimensional sparse numerical arrays. Su
.. ..
.. index:: SparseMat\_
SparseMat\_ SparseMat\_
----------- -----------

File diff suppressed because it is too large Load Diff

View File

@ -43,21 +43,21 @@ Different variants of boosting are known as Discrete Adaboost, Real AdaBoost, Lo
:math:`m` = :math:`m` =
:math:`1,2,...,M` : :math:`1,2,...,M` :
##. #.
Fit the classifier Fit the classifier
:math:`f_m(x) \in{-1,1}` , using weights :math:`f_m(x) \in{-1,1}` , using weights
:math:`w_i` on the training data. :math:`w_i` on the training data.
##. #.
Compute Compute
:math:`err_m = E_w [1_{(y =\neq f_m(x))}], c_m = log((1 - err_m)/err_m)` . :math:`err_m = E_w [1_{(y =\neq f_m(x))}], c_m = log((1 - err_m)/err_m)` .
##. #.
Set Set
:math:`w_i \Leftarrow w_i exp[c_m 1_{(y_i \neq f_m(x_i))}], i = 1,2,...,N,` and renormalize so that :math:`w_i \Leftarrow w_i exp[c_m 1_{(y_i \neq f_m(x_i))}], i = 1,2,...,N,` and renormalize so that
:math:`\Sigma i w_i = 1` . :math:`\Sigma i w_i = 1` .
##. #.
Output the classifier sign Output the classifier sign
:math:`[\Sigma m = 1M c_m f_m(x)]` . :math:`[\Sigma m = 1M c_m f_m(x)]` .
@ -153,67 +153,11 @@ In case of LogitBoost and Gentle AdaBoost, each weak predictor is a regression t
.. index:: CvBoost .. index:: CvBoost
.. _CvBoost:
CvBoost CvBoost
------- -------
.. c:type:: CvBoost .. cpp:class:: CvBoost
Boosted tree classifier ::
class CvBoost : public CvStatModel
{
public:
// Boosting type
enum { DISCRETE=0, REAL=1, LOGIT=2, GENTLE=3 };
// Splitting criteria
enum { DEFAULT=0, GINI=1, MISCLASS=3, SQERR=4 };
CvBoost();
virtual ~CvBoost();
CvBoost( const Mat& _train_data, int _tflag,
const Mat& _responses, const Mat& _var_idx=0,
const Mat& _sample_idx=0, const Mat& _var_type=0,
const Mat& _missing_mask=0,
CvBoostParams params=CvBoostParams() );
virtual bool train( const Mat& _train_data, int _tflag,
const Mat& _responses, const Mat& _var_idx=0,
const Mat& _sample_idx=0, const Mat& _var_type=0,
const Mat& _missing_mask=0,
CvBoostParams params=CvBoostParams(),
bool update=false );
virtual float predict( const Mat& _sample, const Mat& _missing=0,
Mat& weak_responses=0, CvSlice slice=CV_WHOLE_SEQ,
bool raw_mode=false ) const;
virtual void prune( CvSlice slice );
virtual void clear();
virtual void write( CvFileStorage* storage, const char* name );
virtual void read( CvFileStorage* storage, CvFileNode* node );
CvSeq* get_weak_predictors();
const CvBoostParams& get_params() const;
...
protected:
virtual bool set_params( const CvBoostParams& _params );
virtual void update_weights( CvBoostTree* tree );
virtual void trim_weights();
virtual void write_params( CvFileStorage* fs );
virtual void read_params( CvFileStorage* fs, CvFileNode* node );
CvDTreeTrainData* data;
CvBoostParams params;
CvSeq* weak;
...
};
Boosted tree classifier, derived from :cpp:class:`CvStatModel`
.. index:: CvBoost::train .. index:: CvBoost::train