]> rtime.felk.cvut.cz Git - opencv.git/commitdiff
added Mat's method description
authorvp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Tue, 30 Mar 2010 22:51:11 +0000 (22:51 +0000)
committervp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Tue, 30 Mar 2010 22:51:11 +0000 (22:51 +0000)
git-svn-id: https://code.ros.org/svn/opencv/trunk@2951 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08

opencv/doc/cxcore_basic_structures.tex

index 1ebd07aa4e9dbb43684465592e15061c8724a47e..8d297e08cef054b9be7483fa4183177a082da1ee 100644 (file)
@@ -638,7 +638,7 @@ template<typename _Tp> class DataType
 };
 \end{lstlisting}
 
-The template class \texttt{DataType} is descriptive class for OpenCV primitive data types and other types that comply with the following definition. A primitive OpenCV data type is one of \texttt{unsigned char, bool ($\sim$unsigned char), 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. If you are familiar with OpenCV \cross{CvMat}'s type notation, CV\_8U ... CV\_32FC3, CV\_64FC2 etc., then a primitive type can be defined as a type for which you can give a unique identifier in a form \texttt{CV\_<bit-depth>{U|S|F}C<number\_of\_channels>}. A universal OpenCV structure able to store a single instance of such primitive data type is \cross{Vec}. Multiple instances of such a type can be stored to a \texttt{std::vector}, \texttt{Mat}, \texttt{Mat\_}, \texttt{MatND}, \texttt{MatND\_}, \texttt{SparseMat}, \texttt{SparseMat\_} or any other container that is able to store \cross{Vec} instances.
+The template class \texttt{DataType} is descriptive class for OpenCV primitive data types and other types that comply with the following definition. A primitive OpenCV data type is one of \texttt{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. If you are familiar with OpenCV \cross{CvMat}'s type notation, CV\_8U ... CV\_32FC3, CV\_64FC2 etc., then a primitive type can be defined as a type for which you can give a unique identifier in a form \texttt{CV\_<bit-depth>{U|S|F}C<number\_of\_channels>}. A universal OpenCV structure able to store a single instance of such primitive data type is \cross{Vec}. Multiple instances of such a type can be stored to a \texttt{std::vector}, \texttt{Mat}, \texttt{Mat\_}, \texttt{MatND}, \texttt{MatND\_}, \texttt{SparseMat}, \texttt{SparseMat\_} or any other container that is able to store \cross{Vec} instances.
  
 The class \texttt{DataType} is basically used to provide some 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's not \texttt{DataType} itself that is used, but its specialized versions, such as:
 
@@ -1188,7 +1188,7 @@ fprintf(f, ....);
 OpenCV C++ matrix class.
 
 \begin{lstlisting}
-class Mat
+class CV_EXPORTS Mat
 {
 public:
     // constructors
@@ -1196,9 +1196,10 @@ public:
     // constructs matrix of the specified size and type
     // (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.)
     Mat(int _rows, int _cols, int _type);
+    Mat(Size _size, int _type);
     // constucts matrix and fills it with the specified value _s.
     Mat(int _rows, int _cols, int _type, const Scalar& _s);
-    Mat(Size _size, int _type);
+    Mat(Size _size, int _type, const Scalar& _s);
     // copy constructor
     Mat(const Mat& m);
     // constructor for matrix headers pointing to user-allocated data
@@ -1212,7 +1213,7 @@ public:
     // converts old-style IplImage to the new matrix; the data is not copied by default
     Mat(const IplImage* img, bool copyData=false);
     // builds matrix from std::vector with or without copying the data
-    template<typename _Tp> Mat(const vector<_Tp>& vec, bool copyData=false);
+    template<typename _Tp> explicit Mat(const vector<_Tp>& vec, bool copyData=false);
     // helper constructor to compile matrix expressions
     Mat(const MatExpr_Base& expr);
     // destructor - calls release()
@@ -1221,7 +1222,8 @@ public:
     Mat& operator = (const Mat& m);
     Mat& operator = (const MatExpr_Base& expr);
 
-    ...
+    operator MatExpr_<Mat, Mat>() const;
+
     // returns a new matrix header for the specified row
     Mat row(int y) const;
     // returns a new matrix header for the specified column
@@ -1250,7 +1252,8 @@ public:
     // converts matrix to another datatype with optional scalng. See cvConvertScale.
     void convertTo( Mat& m, int rtype, double alpha=1, double beta=0 ) const;
 
-    ...
+    void assignTo( Mat& m, int type=-1 ) const;
+
     // sets every matrix element to s
     Mat& operator = (const Scalar& s);
     // sets some of the matrix elements to s, according to the mask
@@ -1260,26 +1263,32 @@ public:
     Mat reshape(int _cn, int _rows=0) const;
 
     // matrix transposition by means of matrix expressions
-    MatExpr_<...> t() const;
+    MatExpr_<MatExpr_Op2_<Mat, double, Mat, MatOp_T_<Mat> >, Mat>
+    t() const;
     // matrix inversion by means of matrix expressions
-    MatExpr_<...> inv(int method=DECOMP_LU) const;
+    MatExpr_<MatExpr_Op2_<Mat, int, Mat, MatOp_Inv_<Mat> >, Mat>
+        inv(int method=DECOMP_LU) const;
+    MatExpr_<MatExpr_Op4_<Mat, Mat, double, char, Mat, MatOp_MulDiv_<Mat> >, Mat>
     // per-element matrix multiplication by means of matrix expressions
-    MatExpr_<...> mul(const Mat& m, double scale=1) const;
-    MatExpr_<...> mul(const MatExpr_<...>& m, double scale=1) const;
+    mul(const Mat& m, double scale=1) const;
+    MatExpr_<MatExpr_Op4_<Mat, Mat, double, char, Mat, MatOp_MulDiv_<Mat> >, Mat>
+    mul(const MatExpr_<MatExpr_Op2_<Mat, double, Mat, MatOp_Scale_<Mat> >, Mat>& m, double scale=1) const;
+    MatExpr_<MatExpr_Op4_<Mat, Mat, double, char, Mat, MatOp_MulDiv_<Mat> >, Mat>    
+    mul(const MatExpr_<MatExpr_Op2_<Mat, double, Mat, MatOp_DivRS_<Mat> >, Mat>& m, double scale=1) const;
 
     // computes cross-product of 2 3D vectors
     Mat cross(const Mat& m) const;
     // computes dot-product
     double dot(const Mat& m) const;
 
-    // Matlab-style matrix initialization. see the description
+    // Matlab-style matrix initialization
     static MatExpr_Initializer zeros(int rows, int cols, int type);
     static MatExpr_Initializer zeros(Size size, int type);
     static MatExpr_Initializer ones(int rows, int cols, int type);
     static MatExpr_Initializer ones(Size size, int type);
     static MatExpr_Initializer eye(int rows, int cols, int type);
     static MatExpr_Initializer eye(Size size, int type);
-    
+
     // allocates new matrix data unless the matrix already has specified size and type.
     // previous data is unreferenced if needed.
     void create(int _rows, int _cols, int _type);
@@ -1303,7 +1312,7 @@ public:
     operator CvMat() const;
     // converts header to IplImage; no data is copied
     operator IplImage() const;
-    
+
     // returns true iff the matrix data is continuous
     // (i.e. when there are no gaps between successive rows).
     // similar to CV_IS_MAT_CONT(cvmat->type)
@@ -1334,7 +1343,7 @@ public:
     // template version of the above method
     template<typename _Tp> _Tp* ptr(int y=0);
     template<typename _Tp> const _Tp* ptr(int y=0) const;
-    
+
     // template methods for read-write or read-only element access.
     // note that _Tp must match the actual matrix type -
     // the functions do not do any on-fly type conversion
@@ -1342,7 +1351,7 @@ public:
     template<typename _Tp> _Tp& at(Point pt);
     template<typename _Tp> const _Tp& at(int y, int x) const;
     template<typename _Tp> const _Tp& at(Point pt) const;
-    
+
     // template methods for iteration over matrix elements.
     // the iterators take care of skipping gaps in the end of rows (if any)
     template<typename _Tp> MatIterator_<_Tp> begin();
@@ -1368,7 +1377,7 @@ public:
     // pointer to the reference counter;
     // when matrix points to user-allocated data, the pointer is NULL
     int* refcount;
-    
+
     // helper fields used in locateROI and adjustROI
     uchar* datastart;
     uchar* dataend;
@@ -1593,6 +1602,824 @@ This is a list of implemented matrix operations that can be combined in arbitrar
 \end{itemize}
 Note, however, that comma-separated initializers and probably some other operations may require additional explicit \texttt{Mat()} or \verb"Mat_<T>()" constuctor calls to resolve possible ambiguity.
 
+Below is the formal description of the \texttt{Mat} methods.
+
+\cvCppFunc{Mat::Mat}
+Various matrix constructors
+
+\cvdefCpp{
+(1) Mat::Mat();\newline
+(2) Mat::Mat(int rows, int cols, int type);\newline
+(3) Mat::Mat(Size size, int type);\newline
+(4) Mat::Mat(int rows, int cols, int type, const Scalar\& s);\newline
+(5) Mat::Mat(Size size, int type, const Scalar\& s);\newline
+(6) Mat::Mat(const Mat\& m);\newline
+(7) Mat::Mat(int rows, int cols, int type, void* data, size\_t step=AUTO\_STEP);\newline
+(8) Mat::Mat(Size size, int type, void* data, size\_t step=AUTO\_STEP);\newline
+(9) Mat::Mat(const Mat\& m, const Range\& rowRange, const Range\& colRange);\newline
+(10) Mat::Mat(const Mat\& m, const Rect\& roi);\newline
+(11) Mat::Mat(const CvMat* m, bool copyData=false);\newline
+(12) Mat::Mat(const IplImage* img, bool copyData=false);\newline
+(13) template<typename \_Tp> explicit Mat::Mat(const vector<\_Tp>\& vec, bool copyData=false);\newline
+(14) Mat::Mat(const MatExpr\_Base\& expr);
+}
+\begin{description}
+\cvarg{rows}{The number of matrix rows}
+\cvarg{cols}{The number of matrix columns}
+\cvarg{size}{The matrix size: \texttt{Size(cols, rows)}. Note that in the \texttt{Size()} constructor the number of rows and the number of columns go in the reverse order.}
+\cvarg{type}{The matrix type, use \texttt{CV\_8UC1, ..., CV\_64FC4} to create 1-4 channel matrices, or \texttt{CV\_8UC(n), ..., CV\_64FC(n)} to create multi-channel (up to \texttt{CV\_MAX\_CN} channels) matrices}
+\cvarg{s}{The optional value to initialize each matrix element with. To set all the matrix elements to the particular value after the construction, use the assignment operator \texttt{Mat::operator=(const Scalar\& value)}.}
+\cvarg{data}{Pointer to the user data. Matrix constructors that take \texttt{data} and \texttt{step} parameters do not allocate matrix data. Instead, they just initialize the matrix header that points to the specified data, i.e. no data is copied. This operation is very efficient and can be used to process external data using OpenCV functions. The external data is not automatically deallocated, user should take care of it.}
+\cvarg{step}{The \texttt{data} buddy. This optional parameter specifies the number of bytes that each matrix row occupies. The value should include the padding bytes in the end of each row, if any. If the parameter is missing (set to \texttt{cv::AUTO\_STEP}), no padding is assumed and the actual step is calculated as \texttt{cols*elemSize()}, see \cross{Mat::elemSize}().}
+\cvarg{m}{The matrix that (in whole, a partly) is assigned to the constructed matrix. No data is copied by these constructors. Instead, the header pointing to \texttt{m} data, or its rectangular submatrix, is constructed and the associated with it reference counter, if any, is incremented. That is, by modifying the newly constructed matrix, you will also modify the corresponding elements of \texttt{m}.}
+\cvarg{img}{Pointer to the old-style \texttt{IplImage} image structure. By default, the data is shared between the original image and the new matrix, but when \texttt{copyData} is set, the full copy of the image data is created.}
+\cvarg{vec}{STL vector, which elements will form the matrix. The matrix will have a single column and the number of rows equal to the number of vector elements. Type of the matrix will match the type of vector elements. The constructor can handle arbitrary types, for which there is properly declared \cross{DataType}, i.e. the vector elements must be primitive numbers or uni-type numerical tuples of numbers. Mixed-type structures are not supported, of course. Note that the corresponding constructor is explicit, meaning that STL vectors are not automatically converted to \texttt{Mat} instances, you should write \texttt{Mat(vec)} explicitly. Another obvious note: unless you copied the data into the matrix (\texttt{copyData=true}), no new elements should be added to the vector, because it can potentially yield vector data reallocation, and thus the matrix data pointer will become invalid.}
+\cvarg{copyData}{Specifies, whether the underlying data of the STL vector, or the old-style \texttt{CvMat} or \texttt{IplImage} should be copied to (true) or shared with (false) the newly constructed matrix. When the data is copied, the allocated buffer will be managed using \texttt{Mat}'s reference counting mechanism. While when the data is shared, the reference counter will be NULL, and you should not deallocate the data until the matrix is not destructed.}
+\cvarg{rowRange}{The range of the \texttt{m}'s rows to take. As usual, the range start is inclusive and the range end is exclusive. Use \texttt{Range::all()} to take all the rows.}
+\cvarg{colRange}{The range of the \texttt{m}'s columns to take. Use \texttt{Range::all()} to take all the columns.}
+\cvarg{expr}{Matrix expression. See \cross{Matrix Expressions}.}
+\end{description}
+
+These are various constructors that form a matrix. As noticed in the
+\hyperref{AutomaticMemoryManagement2}{introduction}, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression, in which case the old content is dereferenced, or be allocated with \cross{Mat::create}.
+
+\subsection{cv::Mat::\~{}Mat}\index{cv::Mat::\~{}Mat}\label{cppfunc.Mat::destructor}
+Matrix destructor
+
+\cvdefCpp{
+Mat::\~{}Mat();
+}
+
+The matrix destructor calls \cross{Mat::release}.
+
+\cvCppFunc{Mat::operator =}
+Matrix assignment operators
+
+\cvdefCpp{
+Mat\& Mat::operator = (const Mat\& m);\newline
+Mat\& Mat::operator = (const MatExpr\_Base\& expr);\newline
+Mat\& operator = (const Scalar\& s);
+}
+\begin{description}
+\cvarg{m}{The assigned, right-hand-side matrix. Matrix assignment is O(1) operation, that is, no data is copied. Instead, the data is shared and the reference counter, if any, is incremented. Before assigning new data, the old data is dereferenced via \cross{Mat::release}.}
+\cvarg{expr}{The assigned matrix expression object. As opposite to the first form of assignment operation, the second form can reuse already allocated matrix if it has the right size and type to fit the matrix expression result. It is automatically handled by the real function that the matrix expressions is expanded to. For example, \texttt{C=A+B} is expanded to \texttt{cv::add(A, B, C)}, and \cvCppCross{add} will take care of automatic \texttt{C} reallocation.}
+\cvarg{s}{The scalar, assigned to each matrix element. The matrix size or type is not changed.}
+\end{description}
+
+These are the available assignment operators, and they all are very different, so, please, look at the operator parameters description. 
+
+\subsection{cv::Mat::operator MatExpr\_}\index{cv::Mat::operator MatExpr\_}\label{cppfunc.Mat::operator MatExpr}
+Mat-to-MatExpr cast operator
+
+\cvdefCpp{
+Mat::operator MatExpr\_<Mat, Mat>() const;
+}
+
+The cast operator should not be called explicitly. It is used internally by the \cross{Matrix Expressions} engine.
+
+\cvCppFunc{Mat::row}
+Makes a matrix header for the specified matrix row
+
+\cvdefCpp{
+Mat Mat::row(int i) const;
+}
+\begin{description}
+\cvarg{i}{the 0-based row index}
+\end{description}
+
+The method makes a new header for the specified matrix row and returns it. This is O(1) operation, regardless of the matrix size. The underlying data of the new matrix will be shared with the original matrix. Here is the example of one of the classical basic matrix processing operations, axpy, used by LU and many other algorithms:
+
+\begin{lstlisting}
+inline void matrix_axpy(Mat& A, int i, int j, double alpha)
+{
+    A.row(i) += A.row(j)*alpha;
+}
+\end{lstlisting}
+
+\textbf{Important note}. In the current implementation the following code will not work as expected:
+\begin{lstlisting}
+Mat A;
+...
+A.row(i) = A.row(j); // will not work
+\end{lstlisting}
+
+This is because \texttt{A.row(i)} forms a temporary header, which is further assigned another header. Remember, each of these operations is O(1), i.e. no data is copied. Thus, the above assignment will have absolutely no effect, while you may have expected j-th row being copied to i-th row. To achieve that, you should either turn this simple assignment into an expression, or use \cross{Mat::copyTo} method:
+
+\begin{lstlisting}
+Mat A;
+...
+// works, but looks a bit obscure.
+A.row(i) = A.row(j) + 0;
+
+// this is a bit longer, but the recommended method.
+Mat Ai = A.row(i); M.row(j).copyTo(Ai);
+\end{lstlisting}
+
+
+\cvCppFunc{Mat::col}
+Makes a matrix header for the specified matrix column
+
+\cvdefCpp{
+Mat Mat::col(int j) const;
+}
+\begin{description}
+\cvarg{j}{the 0-based column index}
+\end{description}
+
+The method makes a new header for the specified matrix column and returns it. This is O(1) operation, regardless of the matrix size. The underlying data of the new matrix will be shared with the original matrix. See also \cross{Mat::row} description.
+
+
+\cvCppFunc{Mat::rowRange}
+Makes a matrix header for the specified row span
+
+\cvdefCpp{
+Mat Mat::rowRange(int startrow, int endrow) const;\newline
+Mat Mat::rowRange(const Range\& r) const;
+}
+\begin{description}
+\cvarg{startrow}{the 0-based start index of the row span}
+\cvarg{endrow}{the 0-based ending index of the row span}
+\cvarg{r}{The \cvCppCross{Range} structure containing both the start and the end indices}
+\end{description}
+
+The method makes a new header for the specified row span of the matrix. Similarly to \cvCppCross{Mat::row} and \cvCppCross{Mat::col}, this is O(1) operation.
+
+
+\cvCppFunc{Mat::colRange}
+Makes a matrix header for the specified row span
+
+\cvdefCpp{
+Mat Mat::colRange(int startcol, int endcol) const;\newline
+Mat Mat::colRange(const Range\& r) const;
+}
+\begin{description}
+\cvarg{startcol}{the 0-based start index of the column span}
+\cvarg{endcol}{the 0-based ending index of the column span}
+\cvarg{r}{The \cvCppCross{Range} structure containing both the start and the end indices}
+\end{description}
+
+The method makes a new header for the specified column span of the matrix. Similarly to \cvCppCross{Mat::row} and \cvCppCross{Mat::col}, this is O(1) operation.
+
+
+\cvCppFunc{Mat::diag}
+Extracts diagonal from a matrix, or creates a diagonal matrix.
+
+\cvdefCpp{
+Mat Mat::diag(int d) const;
+static Mat Mat::diag(const Mat\& matD);
+}
+\begin{description}
+\cvarg{d}{index of the diagonal, with the following meaning:}
+\begin{description}
+    \cvarg{d=0}{the main diagonal}
+    \cvarg{d>0}{a diagonal from the lower half, e.g. \texttt{d=1} means the diagonal immediately below the main one}
+    \cvarg{d<0}{a diagonal from the upper half, e.g. \texttt{d=1} means the diagonal immediately above the main one}
+\end{description}
+\cvarg{matD}{single-column matrix that will form the diagonal matrix.}
+\end{description}
+
+The method makes a new header for the specified matrix diagonal. The new matrix will be represented as a single-column matrix. Similarly to \cvCppCross{Mat::row} and \cvCppCross{Mat::col}, this is O(1) operation.
+
+
+\cvCppFunc{Mat::clone}
+Creates full copy of the matrix and the underlying data.
+
+\cvdefCpp{
+Mat Mat::clone() const;
+}
+
+The method creates full copy of the matrix. The original matrix \texttt{step} is not taken into the account, however. The matrix copy will be a continuous matrix occupying \texttt{cols*rows*elemSize()} bytes.
+
+
+\cvCppFunc{Mat::copyTo}
+Copies the matrix to another one.
+
+\cvdefCpp{
+void Mat::copyTo( Mat\& m ) const;
+void Mat::copyTo( Mat\& m, const Mat\& mask ) const;
+}
+\begin{description}
+\cvarg{m}{The destination matrix. If it does not have a proper size or type before the operation, it will be reallocated}
+\cvarg{mask}{The operation mask. Its non-zero elements indicate, which matrix elements need to be copied}
+\end{description}
+
+The method copies the matrix data to another matrix. Before copying the data, the method invokes
+
+\begin{lstlisting}
+m.create(this->size(), this->type);
+\end{lstlisting}
+
+so that the destination matrix is reallocated if needed. While \texttt{m.copyTo(m);} will work as expected, i.e. will have no effect, the function does not handle the case of a partial overlap between the source and the destination matrices. 
+
+When the operation mask is specified, and the \texttt{Mat::create} call shown above reallocated the matrix, the newly allocated matrix is initialized with all 0's before copying the data.
+
+
+\cvCppFunc{Mat::copyTo}
+Converts matrix to another datatype with optional scaling.
+
+\cvdefCpp{
+void Mat::convertTo( Mat\& m, int rtype, double alpha=1, double beta=0 ) const;
+}
+\begin{description}
+\cvarg{m}{The destination matrix. If it does not have a proper size or type before the operation, it will be reallocated}
+\cvarg{rtype}{The desired destination matrix type, or rather, the depth (since the number of channels will be the same with the source one). If \texttt{rtype} is negative, the destination matrix will have the same type as the source.}
+\cvarg{alpha}{The optional scale factor}
+\cvarg{beta}{The optional delta, added to the scaled values.}
+\end{description}
+
+The method converts source pixel values to the target datatype. \texttt{saturate\_cast<>} is applied in the end to avoid possible overflows:
+
+\[
+m(x,y) = saturate\_cast<rType>(\alpha (*this)(x,y) + \beta)
+\]
+
+\cvCppFunc{Mat::assignTo}
+Functional form of convertTo
+
+\cvdefCpp{
+void Mat::assignTo( Mat\& m, int type=-1 ) const;
+}
+\begin{description}
+\cvarg{m}{The destination matrix}
+\cvarg{type}{The desired destination matrix depth (or -1 if it should be the same as the source one).}
+\end{description}
+
+This is internal-use method called by the \cross{Matrix Expressions} engine.
+
+\cvCppFunc{Mat::setTo}
+Sets all or some of the matrix elements to the specified value.
+
+\cvdefCpp{
+Mat\& Mat::setTo(const Scalar\& s, const Mat\& mask=Mat());
+}
+\begin{description}
+\cvarg{s}{Assigned scalar, which is converted to the actual matrix type}
+\cvarg{mask}{The operation mask of the same size as \texttt{*this}}
+\end{description}
+
+This is the advanced variant of \texttt{Mat::operator=(const Scalar\& s)} operator.
+
+\cvCppFunc{reshape}
+Changes the matrix's shape and/or the number of channels without copying the data.
+
+\cvdefCpp{
+Mat Mat::reshape(int cn, int rows=0) const;
+}
+
+\begin{description}
+\cvarg{cn}{The new number of channels. If the parameter is 0, the number of channels remains the same.}
+\cvarg{rows}{The new number of rows. If the parameter is 0, the number of rows remains the same.}
+\end{description}
+
+The method makes a new matrix header for \texttt{*this} elements. The new matrix may have different size and/or different number of channels. Any combination is possible, as long as:
+\begin{enumerate}
+\item No extra elements is included into the new matrix and no elements are excluded. Consequently,
+     the product \texttt{rows*cols*channels()} must stay the same after the transformation.
+\item No data is copied, i.e. this is O(1) operation. Consequently, if you change the number of rows, or the operation changes elements' row indices in some other way, the matrix must be continuous. See \cvCppCross{Mat::isContinuous}.
+\end{enumerate}
+
+Here is some small example. Assuming, there is a set of 3D points that are stored as STL vector, and you want to represent the points as \texttt{3xN} matrix. Here is how it can be done:
+
+\begin{lstlisting}
+std::vector<cv::Point3f> vec;
+...
+
+Mat pointMat = Mat(vec). // convert vector to Mat, O(1) operation
+                  reshape(1). // make Nx3 1-channel matrix out of Nx1 3-channel.
+                              // Also, an O(1) operation
+                     t(); // finally, transpose the Nx3 matrix.
+                          // This involves copying of all the elements
+\end{lstlisting} 
+
+
+\cvCppFunc{Mat::t()}
+Transposes the matrix
+
+\cvdefCpp{
+MatExpr\_<MatExpr\_Op2\_<Mat, double, Mat, MatOp\_T\_<Mat> >, Mat>
+Mat::t() const;} 
+
+The method performs matrix transposition by means of matrix expressions.
+That is, the method returns a temporary "matrix transposition" object that can be further used as a part of more complex matrix expression or be assigned to a matrix:
+
+\begin{lstlisting}
+Mat A1 = A + Mat::eye(A.size(), A.type)*lambda;
+Mat C = A1.t()*A1; // compute (A + lambda*I)^t * (A + lamda*I)
+\end{lstlisting} 
+
+\cvCppFunc{Mat::inv}
+Inverses the matrix
+
+\cvdefCpp{
+MatExpr\_<MatExpr\_Op2\_<Mat, int, Mat, MatOp\_Inv\_<Mat> >, Mat>
+Mat::inv(int method=DECOMP\_LU) const;
+}
+
+\begin{description}
+\cvarg{method}{The matrix inversion method, one of}
+\begin{description}
+    \cvarg{DECOMP\_LU}{LU decomposition. The matrix must be non-singular}
+    \cvarg{DECOMP\_CHOLESKY}{Cholesky $LL^T$ decomposition, for symmetrical positively defined matrices only. About twice faster than LU on big matrices.}
+    \cvarg{DECOMP\_SVD}{SVD decomposition. The matrix can be a singular or even non-square, then the pseudo-inverse is computed}
+\end{description}
+\end{description}
+
+The method performs matrix inversion by means of matrix expressions, i.e. a temporary "matrix inversion" object is returned by the method, and can further be used as a part of more complex matrix expression or be assigned to a matrix.
+
+\cvCppFunc{Mat::mul}
+Performs element-wise multiplication or division of the two matrices
+
+\cvdefCpp{
+MatExpr\_<...MatOp\_MulDiv\_<>...>\newline
+Mat::mul(const Mat\& m, double scale=1) const;\newline
+MatExpr\_<...MatOp\_MulDiv\_<>...>\newline
+Mat::mul(const MatExpr\_<...MatOp\_Scale\_<>...>\& m, double scale=1) const;\newline
+MatExpr\_<...MatOp\_MulDiv\_<>...>\newline
+Mat::mul(const MatExpr\_<...MatOp\_DivRS\_<>...>\& m, double scale=1) const;
+}
+
+\begin{description}
+\cvarg{m}{Another matrix, of the same type and the same size as \texttt{*this}, or a scaled matrix, or a scalar divided by a matrix (i.e. a matrix where all the elements are scaled reciprocals of some other matrix)}
+\cvarg{scale}{The optional scale factor}
+\end{description}
+
+The method returns a temporary object encoding per-element matrix multiply or divide operation, with optional scale. Note that this is not a matrix multiplication, corresponding to the simpler "*" operator.
+
+Here is the example that will automatically invoke the third form of the method:
+
+\begin{lstlisting}
+Mat C = A.mul(5/B); // equivalent to divide(A, B, C, 5)
+\end{lstlisting}
+
+\cvCppFunc{Mat::cross}
+Computes cross-product of two 3-element vectors
+
+\cvdefCpp{
+Mat Mat::cross(const Mat\& m) const;
+}
+\begin{lstlisting}
+\cvarg{m}{Another cross-product operand}
+\end{lstlisting}
+
+The method computes cross-product of the two 3-element vectors. The vectors must be 3-elements floating-point vectors of the same shape and the same size. The result will be another 3-element vector of the same shape and the same type as operands.
+
+\cvCppFunc{Mat::dot}
+Computes dot-product of two vectors
+
+\cvdefCpp{
+double Mat::dot(const Mat\& m) const;
+}
+\begin{lstlisting}
+\cvarg{m}{Another dot-product operand.}
+\end{lstlisting}
+
+The method computes dot-product of the two matrices. If the matrices are not single-column or single-row vectors, the top-to-bottom left-to-right scan ordering is used to treat them as 1D vectors. The vectors must have the same size and the same type. If the matrices have more than one channel, the dot products from all the channels are summed together. 
+
+\cvCppFunc{Mat::zeros}
+Returns zero matrix of the specified size and type
+
+\cvdefCpp{
+static MatExpr\_Initializer Mat::zeros(int rows, int cols, int type);
+static MatExpr\_Initializer Mat::zeros(Size size, int type);
+}
+\begin{description}
+\cvarg{rows}{The number of rows}
+\cvarg{cols}{The number of columns}
+\cvarg{size}{Alternative matrix size specification: \texttt{Size(cols, rows)}}
+\cvarg{type}{The created matrix type}
+\end{description}
+
+The method returns Matlab-style zero matrix initializer. It can be used to quickly form a constant matrix and use it as a function parameter, as a part of matrix expression, or as a matrix initializer.
+
+\begin{lstlisting}
+Mat A;
+A = Mat::zeros(3, 3, CV_32F);
+\end{lstlisting}
+
+Note that in the above sample a new matrix will be allocated only if \texttt{A} is not 3x3 floating-point matrix, otherwise the existing matrix \texttt{A} will be filled with 0's.
+
+
+\cvCppFunc{Mat::ones}
+Returns matrix of all 1's of the specified size and type
+
+\cvdefCpp{
+static MatExpr\_Initializer Mat::ones(int rows, int cols, int type);
+static MatExpr\_Initializer Mat::ones(Size size, int type);
+}
+\begin{description}
+\cvarg{rows}{The number of rows}
+\cvarg{cols}{The number of columns}
+\cvarg{size}{Alternative matrix size specification: \texttt{Size(cols, rows)}}
+\cvarg{type}{The created matrix type}
+\end{description}
+
+The method returns Matlab-style ones' matrix initializer, similarly to \cvCppCross{Mat::zeros}. Note that using this method you can initialize a matrix with arbitrary value, using the following Matlab idiom:
+
+\begin{lstlisting}
+Mat A = Mat::ones(100, 100, CV_8U)*3; // make 100x100 matrix filled with 3.
+\end{lstlisting}
+
+The above operation will not form 100x100 matrix of ones and then multiply it by 3. Instead, it will just remember the scale factor (3 in this case) and use it when expanding the matrix initializer.
+
+\cvCppFunc{Mat::eye}
+Returns matrix of all 1's of the specified size and type
+
+\cvdefCpp{
+static MatExpr\_Initializer Mat::eye(int rows, int cols, int type);
+static MatExpr\_Initializer Mat::eye(Size size, int type);
+}
+\begin{description}
+\cvarg{rows}{The number of rows}
+\cvarg{cols}{The number of columns}
+\cvarg{size}{Alternative matrix size specification: \texttt{Size(cols, rows)}}
+\cvarg{type}{The created matrix type}
+\end{description}
+
+The method returns Matlab-style identity matrix initializer, similarly to \cvCppCross{Mat::zeros}. Note that using this method you can initialize a matrix with a scaled identity matrix, by multiplying the initializer by the needed scale factor:
+
+\begin{lstlisting}
+// make a 4x4 diagonal matrix with 0.1's on the diagonal.
+Mat A = Mat::eye(4, 4, CV_32F)*0.1;
+\end{lstlisting}
+
+and this is also done very efficiently in O(1) time.
+
+\cvCppFunc{Mat::create}
+Allocates new matrix data if needed.
+
+\cvdefCpp{
+void Mat::create(int rows, int cols, int type);
+void create(Size size, int type);
+}
+\begin{description}
+\cvarg{rows}{The new number of rows}
+\cvarg{cols}{The new number of columns}
+\cvarg{size}{Alternative new matrix size specification: \texttt{Size(cols, rows)}}
+\cvarg{type}{The new matrix type}
+\end{description}
+
+This is one of the key \texttt{Mat} methods. Most new-style OpenCV functions and methods that produce matrices call this method for each output matrix. The method algorithm is the following:
+
+\begin{enumerate}
+\item if the current matrix size and the type match the new ones, return immediately.
+\item otherwise, dereference the previous data by calling \cvCppCross{Mat::release}
+\item initialize the new header
+\item allocate the new data of \texttt{rows*cols*elemSize()} bytes
+\item allocate the new associated with the data reference counter and set it to 1.
+\end{enumerate}
+
+Such a scheme makes the memory management robust and efficient at the same time, and also saves quite a bit of typing for the user, i.e. usually there is no need to explicitly allocate output matrices.
+
+\cvCppFunc{Mat::addref}
+Increments the reference counter
+
+\cvdefCpp{
+void Mat::addref();
+}
+
+The method increments the reference counter, associated with the matrix data. If the matrix header points to an external data (see \cvCppCross{Mat::Mat}), the reference counter is NULL, and the method has no effect in this case. Normally, the method should not be called explicitly, to avoid memory leaks. It is called implicitly by the matrix assignment operator. The reference counter increment is the atomic operation on the platforms that support it, thus it is safe to operate on the same matrices asynchronously in different threads.
+
+
+\cvCppFunc{Mat::release}
+Decrements the reference counter and deallocates the matrix if needed
+
+\cvdefCpp{
+void Mat::release();
+}
+
+The method decrements the reference counter, associated with the matrix data. When the reference counter reaches 0, the matrix data is deallocated and the data and the reference counter pointers are set to NULL's. If the matrix header points to an external data (see \cvCppCross{Mat::Mat}), the reference counter is NULL, and the method has no effect in this case. 
+
+This method can be called manually to force the matrix data deallocation. But since this method is automatically called in the destructor, or by any other method that changes the data pointer, it is usually not needed. The reference counter decrement and check for 0 is the atomic operation on the platforms that support it, thus it is safe to operate on the same matrices asynchronously in different threads.
+
+\cvCppFunc{Mat::locateROI}
+Locates matrix header within a parent matrix
+
+\cvdefCpp{
+void Mat::locateROI( Size\& wholeSize, Point\& ofs ) const;
+}
+\begin{description}
+\cvarg{wholeSize}{The output parameter that will contain size of the whole matrix, which \texttt{*this} is a part of.}
+\cvarg{ofs}{The output parameter that will contain offset of \texttt{*this} inside the whole matrix}
+\end{description}
+
+After you extracted a submatrix from a matrix using \cvCppCross{Mat::row}, \cvCppCross{Mat::col}, \cvCppCross{Mat::rowRange}, \cvCppCross{Mat::colRange} etc., the result submatrix will point just to the part of the original big matrix. However, each submatrix contains some information (represented by \texttt{datastart} and \texttt{dataend} fields), using which it is possible to reconstruct the original matrix size and the position of the extracted submatrix within the original matrix. The method \texttt{locateROI} does exactly that.
+
+\cvCppFunc{Mat::adjustROI}
+Adjust submatrix size and position within the parent matrix
+
+\cvdefCpp{
+Mat\& Mat::adjustROI( int dtop, int dbottom, int dleft, int dright );
+}
+\begin{description}
+\cvarg{dtop}{The shift of the top submatrix boundary upwards}
+\cvarg{dbottom}{The shift of the bottom submatrix boundary downwards}
+\cvarg{dleft}{The shift of the left submatrix boundary to the left}
+\cvarg{dright}{The shift of the right submatrix boundary to the right}
+\end{description}
+
+The method is complimentary to the \cvCppCross{Mat::locateROI}. Indeed, the typical use of these functions is to determine the submatrix position within the parent matrix and then shift the position somehow. Typically it can be needed for filtering operations, when pixels outside of the ROI should be taken into account. When all the method's parameters are positive, it means that the ROI needs to grow in all directions by the specified amount, i.e.
+
+\begin{lstlisting}
+A.adjustROI(2, 2, 2, 2);
+\end{lstlisting}
+
+increases the matrix size by 4 elements in each direction and shifts it by 2 elements to the left and 2 elements up, which brings in all the necessary pixels for the filtering with 5x5 kernel.
+
+It's user responsibility to make sure that adjustROI does not cross the parent matrix boundary. If it does, the function will signal an error.
+
+The function is used internally by the OpenCV filtering functions, like \cvCppCross{filter2D}, morphological operations etc.
+
+See also \cvCppCross{copyMakeBorder}.
+
+\cvCppFunc{Mat::operator()}
+Extracts a rectangular submatrix
+
+\cvdefCpp{
+Mat Mat::operator()( Range rowRange, Range colRange ) const;\newline
+Mat Mat::operator()( const Rect\& roi ) const;
+}
+\begin{description}
+\cvarg{rowRange}{The start and the end row of the extracted submatrix. The upper boundary is not included. To select all the rows, use \texttt{Range::all()}}
+\cvarg{colRange}{The start and the end column of the extracted submatrix. The upper boundary is not included. To select all the columns, use \texttt{Range::all()}}
+\cvarg{roi}{The extracted submatrix specified as a rectangle}
+\end{description}
+
+The operators make a new header for the specified submatrix of \texttt{*this}. They are the most generalized forms of \cvCppCross{Mat::row}, \cvCppCross{Mat::col}, \cvCppCross{Mat::rowRange} and \cvCppCross{Mat::colRange}. For example, \texttt{A(Range(0, 10), Range::all())} is equivalent to \texttt{A.rowRange(0, 10)}. Similarly to all of the above, the operators are O(1) operations, i.e. no matrix data is copied.
+
+\cvCppFunc{Mat::operator CvMat}
+Creates CvMat header for the matrix
+
+\cvdefCpp{
+Mat::operator CvMat() const;
+}
+
+The operator makes CvMat header for the matrix without copying the underlying data. The reference counter is not taken into account by this operation, thus you should make sure than the original matrix is not deallocated while the \texttt{CvMat} header is used. The operator is useful for intermixing the new and the old OpenCV API's, e.g:
+
+\begin{lstlisting}
+Mat img(Size(320, 240), CV_8UC3);
+...
+
+CvMat cvimg = img;
+my_old_cv_func( &cvimg, ...);
+\end{lstlisting}
+
+where \texttt{my\_old\_cv\_func} is some functions written to work with OpenCV 1.x data structures.
+
+
+\cvCppFunc{Mat::operator IplImage}
+Creates IplImage header for the matrix
+
+\cvdefCpp{
+Mat::operator IplImage() const;
+}
+
+The operator makes IplImage header for the matrix without copying the underlying data. You should make sure than the original matrix is not deallocated while the \texttt{IplImage} header is used. Similarly to \texttt{Mat::operator CvMat}, the operator is useful for intermixing the new and the old OpenCV API's.
+
+
+\cvCppFunc{Mat::isContinuous}
+Reports whether the matrix is continuous or not
+
+\cvdefCpp{
+bool Mat::isContinuous() const;
+}
+
+The method returns true if the matrix elements are stored continuously, i.e. without gaps in the end of each row, and false otherwise. Obviously, \texttt{1x1} or \texttt{1xN} matrices are always continuous. Matrices created with \cvCppCross{Mat::create} are always continuous, but if you extract a part of the matrix using \cvCppCross{Mat::col}, \cvCppCross{Mat::diag} etc. or constructed a matrix header for externally allocated data, such matrices may no longer have this property.
+
+The continuity flag is stored as a bit in \texttt{Mat::flags} field, and is computed automatically when you construct a matrix header, thus the continuity check is very fast operation, though it could be, in theory, done as following:
+
+\begin{lstlisting}
+// alternative implementation of Mat::isContinuous()
+bool myCheckMatContinuity(const Mat& m)
+{
+    //return (m.flags & Mat::CONTINUOUS_FLAG) != 0;
+    return m.rows == 1 || m.step == m.cols*m.elemSize();
+}
+\end{lstlisting}
+
+The method is used in a quite a few of OpenCV functions, and you are welcome to use it as well. The point is that element-wise operations (such as arithmetic and logical operations, math functions, alpha blending, color space transformations etc.) do not depend on the image geometry, and thus, if all the input and all the output arrays are continuous, the functions can process them as very long single-row vectors. Here is the example of how alpha-blending function can be implemented.
+
+\begin{lstlisting}
+template<typename T>
+void alphaBlendRGBA(const Mat& src1, const Mat& src2, Mat& dst)
+{
+    const float alpha_scale = (float)std::numeric_limits<T>::max(),
+                inv_scale = 1.f/alpha_scale;
+    
+    CV_Assert( src1.type() == src2.type() &&
+               src1.type() == CV_MAKETYPE(DataType<T>::depth, 4) &&
+               src1.size() == src2.size());
+    Size size = src1.size();
+    dst.create(size, src1.type());
+    
+    // here is the idiom: check the arrays for continuity and,
+    // if this is the case,
+    // treat the arrays as 1D vectors
+    if( src1.isContinuous() && src2.isContinuous() && dst.isContinuous() )
+    {
+        size.width *= size.height;
+        size.height = 1;
+    }
+    size.width *= 4;
+    
+    for( int i = 0; i < size.height; i++ )
+    {
+        // when the arrays are continuous,
+        // the outer loop is executed only once
+        const T* ptr1 = src1.ptr<T>(i);
+        const T* ptr2 = src2.ptr<T>(i);
+        T* dptr = dst.ptr<T>(i);
+        
+        for( int j = 0; j < size.width; j += 4 )
+        {
+            float alpha = ptr1[j+3]*inv_scale, beta = ptr2[j+3]*inv_scale;
+            dptr[j] = saturate_cast<T>(ptr1[j]*alpha + ptr2[j]*beta);
+            dptr[j+1] = saturate_cast<T>(ptr1[j+1]*alpha + ptr2[j+1]*beta);
+            dptr[j+2] = saturate_cast<T>(ptr1[j+2]*alpha + ptr2[j+2]*beta);
+            dptr[j+3] = saturate_cast<T>((1 - (1-alpha)*(1-beta))*alpha_scale);
+        }
+    }
+}
+\end{lstlisting}
+
+This trick, while being very simple, can boost performance of a simple element-operation by 10-20 percents, especially if the image is rather small and the operation is quite simple.
+
+Also, note that we use another OpenCV idiom in this function - we call \cvCppCross{Mat::create} for the destination array instead of checking that it already has the proper size and type. And while the newly allocated arrays are always continuous, we still check the destination array, because \cvCppCross{create} does not always allocate a new matrix.
+
+\cvCppFunc{Mat::elemSize}
+Returns matrix element size in bytes
+
+\cvdefCpp{
+size\_t Mat::elemSize() const;
+}
+
+The method returns the matrix element size in bytes. For example, if the matrix type is \texttt{CV\_16SC3}, the method will return \texttt{3*sizeof(short)} or 6.
+
+\cvCppFunc{Mat::elemSize1}
+Returns size of each matrix element channel in bytes
+
+\cvdefCpp{
+size\_t Mat::elemSize1() const;
+}
+
+The method returns the matrix element channel size in bytes, that is, it ignores the number of channels. For example, if the matrix type is \texttt{CV\_16SC3}, the method will return \texttt{sizeof(short)} or 2.
+
+\cvCppFunc{Mat::type}
+Returns matrix element type
+
+\cvdefCpp{
+int Mat::type() const;
+}
+
+The method returns the matrix element type, an id, compatible with the \texttt{CvMat} type system, like \texttt{CV\_16SC3} or 16-bit signed 3-channel array etc.
+
+\cvCppFunc{Mat::depth}
+Returns matrix element depth
+
+\cvdefCpp{
+int Mat::depth() const;
+}
+
+The method returns the matrix element depth id, i.e. the type of each individual channel. For example, for 16-bit signed 3-channel array the method will return \texttt{CV\_16S}. The complete list of matrix types:
+\begin{itemize}
+\item \texttt{CV\_8U} - 8-bit unsigned integers (\texttt{0..255})
+\item \texttt{CV\_8S} - 8-bit signed integers (\texttt{-128..127})
+\item \texttt{CV\_16U} - 16-bit unsigned integers (\texttt{0..65535})
+\item \texttt{CV\_16S} - 16-bit signed integers (\texttt{-32768..32767})
+\item \texttt{CV\_32S} - 32-bit signed integers (\texttt{-2147483648..2147483647})
+\item \texttt{CV\_32F} - 32-bit floating-point numbers (\texttt{-FLT\_MAX..FLT\_MAX, INF, NAN})
+\item \texttt{CV\_64F} - 64-bit floating-point numbers (\texttt{-DBL\_MAX..DBL\_MAX, INF, NAN})
+\end{itemize}
+
+\cvCppFunc{Mat::channels}
+Returns matrix element depth
+
+\cvdefCpp{
+int Mat::channels() const;
+}
+
+The method returns the number of matrix channels.
+
+\cvCppFunc{Mat::step1}
+Returns normalized step
+
+\cvdefCpp{
+size\_t Mat::step1() const;
+}
+
+The method returns the matrix step, divided by \cvCppCross{Mat::elemSize1()}. It can be useful for fast access to arbitrary matrix element.
+
+\cvCppFunc{Mat::size}
+Returns the matrix size
+
+\cvdefCpp{
+Size Mat::size() const;
+}
+
+The method returns the matrix size: \texttt{Size(cols, rows)}.
+
+\cvCppFunc{Mat::empty}
+Returns true if matrix data is not allocated
+
+\cvdefCpp{
+bool Mat::empty() const;
+}
+
+The method returns true if and only if the matrix data is NULL pointer. The method has been introduced to improve matrix similarity with STL vector.
+
+\cvCppFunc{Mat::ptr}
+Return pointer to the specified matrix row
+
+\cvdefCpp{
+uchar* Mat::ptr(int i=0);\newline
+const uchar* Mat::ptr(int i=0) const;\newline
+template<typename \_Tp> \_Tp* Mat::ptr(int i=0);\newline
+template<typename \_Tp> const \_Tp* Mat::ptr(int i=0) const;
+}
+\begin{description}
+\cvarg{i}{The 0-based row index}
+\end{description}
+
+The methods return \texttt{uchar*} or typed pointer to the specified matrix row. See the sample in \cvCppCross{Mat::isContinuous}() on how to use these methods.
+
+\cvCppFunc{Mat::at}
+Return reference to the specified matrix element
+
+\cvdefCpp{
+template<typename \_Tp> \_Tp\& Mat::at(int i, int j);\newline
+template<typename \_Tp> \_Tp\& Mat::at(Point pt);\newline
+template<typename \_Tp> const \_Tp\& Mat::at(int i, int j) const;\newline
+template<typename \_Tp> const \_Tp\& Mat::at(Point pt) const;
+}
+\begin{description}
+\cvarg{i}{The 0-based row index}
+\cvarg{j}{The 0-based column index}
+\cvarg{pt}{The element position specified as \texttt{Point(j,i)}}
+\end{description}
+
+The template methods return reference to the specified matrix element. For the sake of higher performance the index range checks are only performed in Debug configuration.
+
+Here is the how you can, for example, create one of the standard poor-conditioned test matrices for various numerical algorithms using the \texttt{Mat::at} method:
+
+\begin{lstlisting}
+Mat H(100, 100, CV_64F);
+for(int i = 0; i < H.rows; i++)
+    for(int j = 0; j < H.cols; j++)
+        H.at<double>(i,j)=1./(i+j+1);
+\end{lstlisting}
+
+\cvCppFunc{Mat::begin}
+Return the matrix iterator, set to the first matrix element
+
+\cvdefCpp{
+template<typename \_Tp> MatIterator\_<\_Tp> Mat::begin();
+template<typename \_Tp> MatConstIterator\_<\_Tp> Mat::begin() const;
+}
+
+The methods return the matrix read-only or read-write iterators. The use of matrix iterators is very similar to the use of bi-directional STL iterators. Here is the alpha blending function rewritten using the matrix iterators:
+
+\begin{lstlisting}
+template<typename T>
+void alphaBlendRGBA(const Mat& src1, const Mat& src2, Mat& dst)
+{
+    typedef Vec<T, 4> VT;
+    
+    const float alpha_scale = (float)std::numeric_limits<T>::max(),
+                inv_scale = 1.f/alpha_scale;
+    
+    CV_Assert( src1.type() == src2.type() &&
+               src1.type() == DataType<VT>::type &&
+               src1.size() == src2.size());
+    Size size = src1.size();
+    dst.create(size, src1.type());
+    
+    MatConstIterator_<VT> it1 = src1.begin<VT>(), it1_end = src1.end<VT>();
+    MatConstIterator_<VT> it2 = src2.begin<VT>();
+    MatIterator_<VT> dst_it = dst.begin<VT>();
+    
+    for( ; it1 != it1_end; ++it1, ++it2, ++dst_it )
+    {
+        VT pix1 = *it1, pix2 = *it2;
+        float alpha = pix1[3]*inv_scale, beta = pix2[3]*inv_scale;
+        *dst_it = VT(saturate_cast<T>(pix1[0]*alpha + pix2[0]*beta),
+                     saturate_cast<T>(pix1[1]*alpha + pix2[1]*beta),
+                     saturate_cast<T>(pix1[2]*alpha + pix2[2]*beta),
+                     saturate_cast<T>((1 - (1-alpha)*(1-beta))*alpha_scale));
+    }
+}
+\end{lstlisting}
+
+
+\cvCppFunc{Mat::end}
+Return the matrix iterator, set to the after-last matrix element
+
+\cvdefCpp{
+template<typename \_Tp> MatIterator\_<\_Tp> Mat::end();
+template<typename \_Tp> MatConstIterator\_<\_Tp> Mat::end() const;
+}
+
+The methods return the matrix read-only or read-write iterators, set to the point following the last matrix element.
+
+
 \subsection{Mat\_}\label{MatT}
 Template matrix class derived from \cross{Mat}