|
|
|
@ -140,7 +140,7 @@ public: |
|
|
|
|
|
|
|
|
|
By default the function prints information about the error to stderr, |
|
|
|
|
then it either stops if cv::setBreakOnError() had been called before or raises the exception. |
|
|
|
|
It is possible to alternate error processing by using cv::redirectError(). |
|
|
|
|
It is possible to alternate error processing by using #redirectError(). |
|
|
|
|
@param exc the exception raisen. |
|
|
|
|
@deprecated drop this version |
|
|
|
|
*/ |
|
|
|
@ -175,7 +175,7 @@ enum CovarFlags { |
|
|
|
|
/**The output covariance matrix is calculated as:
|
|
|
|
|
\f[\texttt{scale} \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...] \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...]^T,\f] |
|
|
|
|
covar will be a square matrix of the same size as the total number of elements in each input |
|
|
|
|
vector. One and only one of COVAR_SCRAMBLED and COVAR_NORMAL must be specified.*/ |
|
|
|
|
vector. One and only one of #COVAR_SCRAMBLED and #COVAR_NORMAL must be specified.*/ |
|
|
|
|
COVAR_NORMAL = 1, |
|
|
|
|
/** If the flag is specified, the function does not calculate mean from
|
|
|
|
|
the input vectors but, instead, uses the passed mean vector. This is useful if mean has been |
|
|
|
@ -266,8 +266,8 @@ Normally, the function is not called directly. It is used inside filtering funct |
|
|
|
|
copyMakeBorder. |
|
|
|
|
@param p 0-based coordinate of the extrapolated pixel along one of the axes, likely \<0 or \>= len |
|
|
|
|
@param len Length of the array along the corresponding axis. |
|
|
|
|
@param borderType Border type, one of the cv::BorderTypes, except for cv::BORDER_TRANSPARENT and |
|
|
|
|
cv::BORDER_ISOLATED . When borderType==cv::BORDER_CONSTANT , the function always returns -1, regardless |
|
|
|
|
@param borderType Border type, one of the #BorderTypes, except for #BORDER_TRANSPARENT and |
|
|
|
|
#BORDER_ISOLATED . When borderType==#BORDER_CONSTANT , the function always returns -1, regardless |
|
|
|
|
of p and len. |
|
|
|
|
|
|
|
|
|
@sa copyMakeBorder |
|
|
|
@ -304,7 +304,7 @@ function does not copy src itself but simply constructs the border, for example: |
|
|
|
|
@endcode |
|
|
|
|
@note When the source image is a part (ROI) of a bigger image, the function will try to use the |
|
|
|
|
pixels outside of the ROI to form a border. To disable this feature and always do extrapolation, as |
|
|
|
|
if src was not a ROI, use borderType | BORDER_ISOLATED. |
|
|
|
|
if src was not a ROI, use borderType | #BORDER_ISOLATED. |
|
|
|
|
|
|
|
|
|
@param src Source image. |
|
|
|
|
@param dst Destination image of the same type as src and the size Size(src.cols+left+right, |
|
|
|
@ -642,7 +642,7 @@ CV_EXPORTS_W void meanStdDev(InputArray src, OutputArray mean, OutputArray stdde |
|
|
|
|
|
|
|
|
|
/** @brief Calculates the absolute norm of an array.
|
|
|
|
|
|
|
|
|
|
This version of cv::norm calculates the absolute norm of src1. The type of norm to calculate is specified using cv::NormTypes. |
|
|
|
|
This version of #norm calculates the absolute norm of src1. The type of norm to calculate is specified using #NormTypes. |
|
|
|
|
|
|
|
|
|
As example for one array consider the function \f$r(x)= \begin{pmatrix} x \\ 1-x \end{pmatrix}, x \in [-1;1]\f$. |
|
|
|
|
The \f$ L_{1}, L_{2} \f$ and \f$ L_{\infty} \f$ norm for the sample value \f$r(-1) = \begin{pmatrix} -1 \\ 2 \end{pmatrix}\f$ |
|
|
|
@ -664,7 +664,7 @@ It is notable that the \f$ L_{1} \f$ norm forms the upper and the \f$ L_{\infty} |
|
|
|
|
|
|
|
|
|
When the mask parameter is specified and it is not empty, the norm is |
|
|
|
|
|
|
|
|
|
If normType is not specified, NORM_L2 is used. |
|
|
|
|
If normType is not specified, #NORM_L2 is used. |
|
|
|
|
calculated only over the region specified by the mask. |
|
|
|
|
|
|
|
|
|
Multi-channel input arrays are treated as single-channel arrays, that is, |
|
|
|
@ -673,7 +673,7 @@ the results for all channels are combined. |
|
|
|
|
Hamming norms can only be calculated with CV_8U depth arrays. |
|
|
|
|
|
|
|
|
|
@param src1 first input array. |
|
|
|
|
@param normType type of the norm (see cv::NormTypes). |
|
|
|
|
@param normType type of the norm (see #NormTypes). |
|
|
|
|
@param mask optional operation mask; it must have the same size as src1 and CV_8UC1 type. |
|
|
|
|
*/ |
|
|
|
|
CV_EXPORTS_W double norm(InputArray src1, int normType = NORM_L2, InputArray mask = noArray()); |
|
|
|
@ -682,18 +682,18 @@ CV_EXPORTS_W double norm(InputArray src1, int normType = NORM_L2, InputArray mas |
|
|
|
|
|
|
|
|
|
This version of cv::norm calculates the absolute difference norm |
|
|
|
|
or the relative difference norm of arrays src1 and src2. |
|
|
|
|
The type of norm to calculate is specified using cv::NormTypes. |
|
|
|
|
The type of norm to calculate is specified using #NormTypes. |
|
|
|
|
|
|
|
|
|
@param src1 first input array. |
|
|
|
|
@param src2 second input array of the same size and the same type as src1. |
|
|
|
|
@param normType type of the norm (cv::NormTypes). |
|
|
|
|
@param normType type of the norm (see #NormTypes). |
|
|
|
|
@param mask optional operation mask; it must have the same size as src1 and CV_8UC1 type. |
|
|
|
|
*/ |
|
|
|
|
CV_EXPORTS_W double norm(InputArray src1, InputArray src2, |
|
|
|
|
int normType = NORM_L2, InputArray mask = noArray()); |
|
|
|
|
/** @overload
|
|
|
|
|
@param src first input array. |
|
|
|
|
@param normType type of the norm (see cv::NormTypes). |
|
|
|
|
@param normType type of the norm (see #NormTypes). |
|
|
|
|
*/ |
|
|
|
|
CV_EXPORTS double norm( const SparseMat& src, int normType ); |
|
|
|
|
|
|
|
|
@ -859,11 +859,11 @@ CV_EXPORTS void minMaxLoc(const SparseMat& a, double* minVal, |
|
|
|
|
|
|
|
|
|
/** @brief Reduces a matrix to a vector.
|
|
|
|
|
|
|
|
|
|
The function cv::reduce reduces the matrix to a vector by treating the matrix rows/columns as a set of |
|
|
|
|
The function #reduce reduces the matrix to a vector by treating the matrix rows/columns as a set of |
|
|
|
|
1D vectors and performing the specified operation on the vectors until a single row/column is |
|
|
|
|
obtained. For example, the function can be used to compute horizontal and vertical projections of a |
|
|
|
|
raster image. In case of REDUCE_MAX and REDUCE_MIN , the output image should have the same type as the source one. |
|
|
|
|
In case of REDUCE_SUM and REDUCE_AVG , the output may have a larger element bit-depth to preserve accuracy. |
|
|
|
|
raster image. In case of #REDUCE_MAX and #REDUCE_MIN , the output image should have the same type as the source one. |
|
|
|
|
In case of #REDUCE_SUM and #REDUCE_AVG , the output may have a larger element bit-depth to preserve accuracy. |
|
|
|
|
And multi-channel arrays are also supported in these two reduction modes. |
|
|
|
|
|
|
|
|
|
The following code demonstrates its usage for a single channel matrix. |
|
|
|
@ -876,7 +876,7 @@ And the following code demonstrates its usage for a two-channel matrix. |
|
|
|
|
@param dst output vector. Its size and type is defined by dim and dtype parameters. |
|
|
|
|
@param dim dimension index along which the matrix is reduced. 0 means that the matrix is reduced to |
|
|
|
|
a single row. 1 means that the matrix is reduced to a single column. |
|
|
|
|
@param rtype reduction operation that could be one of cv::ReduceTypes |
|
|
|
|
@param rtype reduction operation that could be one of #ReduceTypes |
|
|
|
|
@param dtype when negative, the output vector will have the same type as the input matrix, |
|
|
|
|
otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src.channels()). |
|
|
|
|
@sa repeat |
|
|
|
@ -1803,15 +1803,15 @@ The function cv::invert inverts the matrix src and stores the result in dst |
|
|
|
|
the pseudo-inverse matrix (the dst matrix) so that norm(src\*dst - I) is |
|
|
|
|
minimal, where I is an identity matrix. |
|
|
|
|
|
|
|
|
|
In case of the DECOMP_LU method, the function returns non-zero value if |
|
|
|
|
In case of the #DECOMP_LU method, the function returns non-zero value if |
|
|
|
|
the inverse has been successfully calculated and 0 if src is singular. |
|
|
|
|
|
|
|
|
|
In case of the DECOMP_SVD method, the function returns the inverse |
|
|
|
|
In case of the #DECOMP_SVD method, the function returns the inverse |
|
|
|
|
condition number of src (the ratio of the smallest singular value to the |
|
|
|
|
largest singular value) and 0 if src is singular. The SVD method |
|
|
|
|
calculates a pseudo-inverse matrix if src is singular. |
|
|
|
|
|
|
|
|
|
Similarly to DECOMP_LU, the method DECOMP_CHOLESKY works only with |
|
|
|
|
Similarly to #DECOMP_LU, the method #DECOMP_CHOLESKY works only with |
|
|
|
|
non-singular square matrices that should also be symmetrical and |
|
|
|
|
positively defined. In this case, the function stores the inverted |
|
|
|
|
matrix in dst and returns non-zero. Otherwise, it returns 0. |
|
|
|
@ -1827,10 +1827,10 @@ CV_EXPORTS_W double invert(InputArray src, OutputArray dst, int flags = DECOMP_L |
|
|
|
|
|
|
|
|
|
The function cv::solve solves a linear system or least-squares problem (the |
|
|
|
|
latter is possible with SVD or QR methods, or by specifying the flag |
|
|
|
|
DECOMP_NORMAL ): |
|
|
|
|
#DECOMP_NORMAL ): |
|
|
|
|
\f[\texttt{dst} = \arg \min _X \| \texttt{src1} \cdot \texttt{X} - \texttt{src2} \|\f] |
|
|
|
|
|
|
|
|
|
If DECOMP_LU or DECOMP_CHOLESKY method is used, the function returns 1 |
|
|
|
|
If #DECOMP_LU or #DECOMP_CHOLESKY method is used, the function returns 1 |
|
|
|
|
if src1 (or \f$\texttt{src1}^T\texttt{src1}\f$ ) is non-singular. Otherwise, |
|
|
|
|
it returns 0. In the latter case, dst is not valid. Other methods find a |
|
|
|
|
pseudo-solution in case of a singular left-hand side part. |
|
|
|
@ -1842,7 +1842,7 @@ will not do the work. Use SVD::solveZ instead. |
|
|
|
|
@param src1 input matrix on the left-hand side of the system. |
|
|
|
|
@param src2 input matrix on the right-hand side of the system. |
|
|
|
|
@param dst output solution. |
|
|
|
|
@param flags solution (matrix inversion) method (cv::DecompTypes) |
|
|
|
|
@param flags solution (matrix inversion) method (#DecompTypes) |
|
|
|
|
@sa invert, SVD, eigen |
|
|
|
|
*/ |
|
|
|
|
CV_EXPORTS_W bool solve(InputArray src1, InputArray src2, |
|
|
|
@ -1858,7 +1858,7 @@ proper comparison predicate. |
|
|
|
|
|
|
|
|
|
@param src input single-channel array. |
|
|
|
|
@param dst output array of the same size and type as src. |
|
|
|
|
@param flags operation flags, a combination of cv::SortFlags |
|
|
|
|
@param flags operation flags, a combination of #SortFlags |
|
|
|
|
@sa sortIdx, randShuffle |
|
|
|
|
*/ |
|
|
|
|
CV_EXPORTS_W void sort(InputArray src, OutputArray dst, int flags); |
|
|
|
@ -1954,7 +1954,7 @@ the set of input vectors. |
|
|
|
|
@param nsamples number of samples |
|
|
|
|
@param covar output covariance matrix of the type ctype and square size. |
|
|
|
|
@param mean input or output (depending on the flags) array as the average value of the input vectors. |
|
|
|
|
@param flags operation flags as a combination of cv::CovarFlags |
|
|
|
|
@param flags operation flags as a combination of #CovarFlags |
|
|
|
|
@param ctype type of the matrixl; it equals 'CV_64F' by default. |
|
|
|
|
@sa PCA, mulTransposed, Mahalanobis |
|
|
|
|
@todo InputArrayOfArrays |
|
|
|
@ -1963,11 +1963,11 @@ CV_EXPORTS void calcCovarMatrix( const Mat* samples, int nsamples, Mat& covar, M |
|
|
|
|
int flags, int ctype = CV_64F); |
|
|
|
|
|
|
|
|
|
/** @overload
|
|
|
|
|
@note use cv::COVAR_ROWS or cv::COVAR_COLS flag |
|
|
|
|
@note use #COVAR_ROWS or #COVAR_COLS flag |
|
|
|
|
@param samples samples stored as rows/columns of a single matrix. |
|
|
|
|
@param covar output covariance matrix of the type ctype and square size. |
|
|
|
|
@param mean input or output (depending on the flags) array as the average value of the input vectors. |
|
|
|
|
@param flags operation flags as a combination of cv::CovarFlags |
|
|
|
|
@param flags operation flags as a combination of #CovarFlags |
|
|
|
|
@param ctype type of the matrixl; it equals 'CV_64F' by default. |
|
|
|
|
*/ |
|
|
|
|
CV_EXPORTS_W void calcCovarMatrix( InputArray samples, OutputArray covar, |
|
|
|
@ -2000,8 +2000,8 @@ CV_EXPORTS_W void SVBackSubst( InputArray w, InputArray u, InputArray vt, |
|
|
|
|
|
|
|
|
|
The function cv::Mahalanobis calculates and returns the weighted distance between two vectors: |
|
|
|
|
\f[d( \texttt{vec1} , \texttt{vec2} )= \sqrt{\sum_{i,j}{\texttt{icovar(i,j)}\cdot(\texttt{vec1}(I)-\texttt{vec2}(I))\cdot(\texttt{vec1(j)}-\texttt{vec2(j)})} }\f] |
|
|
|
|
The covariance matrix may be calculated using the cv::calcCovarMatrix function and then inverted using |
|
|
|
|
the invert function (preferably using the cv::DECOMP_SVD method, as the most accurate). |
|
|
|
|
The covariance matrix may be calculated using the #calcCovarMatrix function and then inverted using |
|
|
|
|
the invert function (preferably using the #DECOMP_SVD method, as the most accurate). |
|
|
|
|
@param v1 first 1D input vector. |
|
|
|
|
@param v2 second 1D input vector. |
|
|
|
|
@param icovar inverse covariance matrix. |
|
|
|
@ -2031,28 +2031,28 @@ is how 2D *CCS* spectrum looks: |
|
|
|
|
In case of 1D transform of a real vector, the output looks like the first row of the matrix above. |
|
|
|
|
|
|
|
|
|
So, the function chooses an operation mode depending on the flags and size of the input array: |
|
|
|
|
- If DFT_ROWS is set or the input array has a single row or single column, the function |
|
|
|
|
performs a 1D forward or inverse transform of each row of a matrix when DFT_ROWS is set. |
|
|
|
|
- If #DFT_ROWS is set or the input array has a single row or single column, the function |
|
|
|
|
performs a 1D forward or inverse transform of each row of a matrix when #DFT_ROWS is set. |
|
|
|
|
Otherwise, it performs a 2D transform. |
|
|
|
|
- If the input array is real and DFT_INVERSE is not set, the function performs a forward 1D or |
|
|
|
|
- If the input array is real and #DFT_INVERSE is not set, the function performs a forward 1D or |
|
|
|
|
2D transform: |
|
|
|
|
- When DFT_COMPLEX_OUTPUT is set, the output is a complex matrix of the same size as |
|
|
|
|
- When #DFT_COMPLEX_OUTPUT is set, the output is a complex matrix of the same size as |
|
|
|
|
input. |
|
|
|
|
- When DFT_COMPLEX_OUTPUT is not set, the output is a real matrix of the same size as |
|
|
|
|
- When #DFT_COMPLEX_OUTPUT is not set, the output is a real matrix of the same size as |
|
|
|
|
input. In case of 2D transform, it uses the packed format as shown above. In case of a |
|
|
|
|
single 1D transform, it looks like the first row of the matrix above. In case of |
|
|
|
|
multiple 1D transforms (when using the DFT_ROWS flag), each row of the output matrix |
|
|
|
|
multiple 1D transforms (when using the #DFT_ROWS flag), each row of the output matrix |
|
|
|
|
looks like the first row of the matrix above. |
|
|
|
|
- If the input array is complex and either DFT_INVERSE or DFT_REAL_OUTPUT are not set, the |
|
|
|
|
- If the input array is complex and either #DFT_INVERSE or #DFT_REAL_OUTPUT are not set, the |
|
|
|
|
output is a complex array of the same size as input. The function performs a forward or |
|
|
|
|
inverse 1D or 2D transform of the whole input array or each row of the input array |
|
|
|
|
independently, depending on the flags DFT_INVERSE and DFT_ROWS. |
|
|
|
|
- When DFT_INVERSE is set and the input array is real, or it is complex but DFT_REAL_OUTPUT |
|
|
|
|
- When #DFT_INVERSE is set and the input array is real, or it is complex but #DFT_REAL_OUTPUT |
|
|
|
|
is set, the output is a real array of the same size as input. The function performs a 1D or 2D |
|
|
|
|
inverse transformation of the whole input array or each individual row, depending on the flags |
|
|
|
|
DFT_INVERSE and DFT_ROWS. |
|
|
|
|
#DFT_INVERSE and #DFT_ROWS. |
|
|
|
|
|
|
|
|
|
If DFT_SCALE is set, the scaling is done after the transformation. |
|
|
|
|
If #DFT_SCALE is set, the scaling is done after the transformation. |
|
|
|
|
|
|
|
|
|
Unlike dct , the function supports arrays of arbitrary size. But only those arrays are processed |
|
|
|
|
efficiently, whose sizes can be factorized in a product of small prime numbers (2, 3, and 5 in the |
|
|
|
@ -2118,7 +2118,7 @@ To optimize this sample, consider the following approaches: |
|
|
|
|
- If different tiles in C can be calculated in parallel and, thus, the convolution is done by |
|
|
|
|
parts, the loop can be threaded. |
|
|
|
|
|
|
|
|
|
All of the above improvements have been implemented in matchTemplate and filter2D . Therefore, by |
|
|
|
|
All of the above improvements have been implemented in #matchTemplate and #filter2D . Therefore, by |
|
|
|
|
using them, you can get the performance even better than with the above theoretically optimal |
|
|
|
|
implementation. Though, those two functions actually calculate cross-correlation, not convolution, |
|
|
|
|
so you need to "flip" the second convolution operand B vertically and horizontally using flip . |
|
|
|
@ -2131,10 +2131,10 @@ so you need to "flip" the second convolution operand B vertically and horizontal |
|
|
|
|
opencv_source/samples/python/dft.py |
|
|
|
|
@param src input array that could be real or complex. |
|
|
|
|
@param dst output array whose size and type depends on the flags . |
|
|
|
|
@param flags transformation flags, representing a combination of the cv::DftFlags |
|
|
|
|
@param flags transformation flags, representing a combination of the #DftFlags |
|
|
|
|
@param nonzeroRows when the parameter is not zero, the function assumes that only the first |
|
|
|
|
nonzeroRows rows of the input array (DFT_INVERSE is not set) or only the first nonzeroRows of the |
|
|
|
|
output array (DFT_INVERSE is set) contain non-zeros, thus, the function can handle the rest of the |
|
|
|
|
nonzeroRows rows of the input array (#DFT_INVERSE is not set) or only the first nonzeroRows of the |
|
|
|
|
output array (#DFT_INVERSE is set) contain non-zeros, thus, the function can handle the rest of the |
|
|
|
|
rows more efficiently and save some time; this technique is very useful for calculating array |
|
|
|
|
cross-correlation or convolution using DFT. |
|
|
|
|
@sa dct , getOptimalDFTSize , mulSpectrums, filter2D , matchTemplate , flip , cartToPolar , |
|
|
|
@ -2144,13 +2144,13 @@ CV_EXPORTS_W void dft(InputArray src, OutputArray dst, int flags = 0, int nonzer |
|
|
|
|
|
|
|
|
|
/** @brief Calculates the inverse Discrete Fourier Transform of a 1D or 2D array.
|
|
|
|
|
|
|
|
|
|
idft(src, dst, flags) is equivalent to dft(src, dst, flags | DFT_INVERSE) . |
|
|
|
|
@note None of dft and idft scales the result by default. So, you should pass DFT_SCALE to one of |
|
|
|
|
idft(src, dst, flags) is equivalent to dft(src, dst, flags | #DFT_INVERSE) . |
|
|
|
|
@note None of dft and idft scales the result by default. So, you should pass #DFT_SCALE to one of |
|
|
|
|
dft or idft explicitly to make these transforms mutually inverse. |
|
|
|
|
@sa dft, dct, idct, mulSpectrums, getOptimalDFTSize |
|
|
|
|
@param src input floating-point real or complex array. |
|
|
|
|
@param dst output array whose size and type depend on the flags. |
|
|
|
|
@param flags operation flags (see dft and cv::DftFlags). |
|
|
|
|
@param flags operation flags (see dft and #DftFlags). |
|
|
|
|
@param nonzeroRows number of dst rows to process; the rest of the rows have undefined content (see |
|
|
|
|
the convolution sample in dft description. |
|
|
|
|
*/ |
|
|
|
@ -2175,9 +2175,9 @@ floating-point array: |
|
|
|
|
\f[X = \left (C^{(N)} \right )^T \cdot X \cdot C^{(N)}\f] |
|
|
|
|
|
|
|
|
|
The function chooses the mode of operation by looking at the flags and size of the input array: |
|
|
|
|
- If (flags & DCT_INVERSE) == 0 , the function does a forward 1D or 2D transform. Otherwise, it |
|
|
|
|
- If (flags & #DCT_INVERSE) == 0 , the function does a forward 1D or 2D transform. Otherwise, it |
|
|
|
|
is an inverse 1D or 2D transform. |
|
|
|
|
- If (flags & DCT_ROWS) != 0 , the function performs a 1D transform of each row. |
|
|
|
|
- If (flags & #DCT_ROWS) != 0 , the function performs a 1D transform of each row. |
|
|
|
|
- If the array is a single column or a single row, the function performs a 1D transform. |
|
|
|
|
- If none of the above is true, the function performs a 2D transform. |
|
|
|
|
|
|
|
|
@ -2714,7 +2714,7 @@ public: |
|
|
|
|
if you need to solve many linear systems with the same left-hand side |
|
|
|
|
(for example, src ). If all you need is to solve a single system |
|
|
|
|
(possibly with multiple rhs immediately available), simply call solve |
|
|
|
|
add pass DECOMP_SVD there. It does absolutely the same thing. |
|
|
|
|
add pass #DECOMP_SVD there. It does absolutely the same thing. |
|
|
|
|
*/ |
|
|
|
|
void backSubst( InputArray rhs, OutputArray dst ) const; |
|
|
|
|
|
|
|
|
@ -2977,7 +2977,7 @@ function parameter). |
|
|
|
|
after every attempt. The best (minimum) value is chosen and the corresponding labels and the |
|
|
|
|
compactness value are returned by the function. Basically, you can use only the core of the |
|
|
|
|
function, set the number of attempts to 1, initialize labels each time using a custom algorithm, |
|
|
|
|
pass them with the ( flags = KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best |
|
|
|
|
pass them with the ( flags = #KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best |
|
|
|
|
(most-compact) clustering. |
|
|
|
|
*/ |
|
|
|
|
CV_EXPORTS_W double kmeans( InputArray data, int K, InputOutputArray bestLabels, |
|
|
|
@ -3054,31 +3054,8 @@ matching, graph-cut etc.), background subtraction (which can be done using mixtu |
|
|
|
|
models, codebook-based algorithm etc.), optical flow (block matching, Lucas-Kanade, Horn-Schunck |
|
|
|
|
etc.). |
|
|
|
|
|
|
|
|
|
Here is example of SIFT use in your application via Algorithm interface: |
|
|
|
|
@code |
|
|
|
|
#include "opencv2/opencv.hpp" |
|
|
|
|
#include "opencv2/xfeatures2d.hpp" |
|
|
|
|
using namespace cv::xfeatures2d; |
|
|
|
|
|
|
|
|
|
Ptr<Feature2D> sift = SIFT::create(); |
|
|
|
|
FileStorage fs("sift_params.xml", FileStorage::READ); |
|
|
|
|
if( fs.isOpened() ) // if we have file with parameters, read them
|
|
|
|
|
{ |
|
|
|
|
sift->read(fs["sift_params"]); |
|
|
|
|
fs.release(); |
|
|
|
|
} |
|
|
|
|
else // else modify the parameters and store them; user can later edit the file to use different parameters
|
|
|
|
|
{ |
|
|
|
|
sift->setContrastThreshold(0.01f); // lower the contrast threshold, compared to the default value
|
|
|
|
|
{ |
|
|
|
|
WriteStructContext ws(fs, "sift_params", CV_NODE_MAP); |
|
|
|
|
sift->write(fs); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
Mat image = imread("myimage.png", 0), descriptors; |
|
|
|
|
vector<KeyPoint> keypoints; |
|
|
|
|
sift->detectAndCompute(image, noArray(), keypoints, descriptors); |
|
|
|
|
@endcode |
|
|
|
|
Here is example of SimpleBlobDetector use in your application via Algorithm interface: |
|
|
|
|
@snippet snippets/core_various.cpp Algorithm |
|
|
|
|
*/ |
|
|
|
|
class CV_EXPORTS_W Algorithm |
|
|
|
|
{ |
|
|
|
|