@ -14,7 +14,7 @@
// For Open Source Computer Vision Library
// For Open Source Computer Vision Library
//
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Copyright (C) 2009-2011 , Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
// Third party copyrights are property of their respective owners.
//
//
// Redistribution and use in source and binary forms, with or without modification,
// Redistribution and use in source and binary forms, with or without modification,
@ -641,6 +641,8 @@ typedef Vec<ushort, 4> Vec4w;
typedef Vec < int , 2 > Vec2i ;
typedef Vec < int , 2 > Vec2i ;
typedef Vec < int , 3 > Vec3i ;
typedef Vec < int , 3 > Vec3i ;
typedef Vec < int , 4 > Vec4i ;
typedef Vec < int , 4 > Vec4i ;
typedef Vec < int , 6 > Vec6i ;
typedef Vec < int , 8 > Vec8i ;
typedef Vec < float , 2 > Vec2f ;
typedef Vec < float , 2 > Vec2f ;
typedef Vec < float , 3 > Vec3f ;
typedef Vec < float , 3 > Vec3f ;
@ -1252,10 +1254,90 @@ public:
protected :
protected :
_Tp * obj ; //< the object pointer.
_Tp * obj ; //< the object pointer.
int * refcount ; //< the associated bbbbbbbbbbbbbbbbbb reference counter
int * refcount ; //< the associated reference counter
} ;
} ;
//////////////////////////////// Mat ////////////////////////////////
//////////////////////// Input/Output Array Arguments /////////////////////////////////
/*!
Proxy datatype for passing Mat ' s and vector < > ' s as input parameters
*/
class CV_EXPORTS InputArray
{
public :
enum { KIND_SHIFT = 16 , NONE = 0 < < KIND_SHIFT , MAT = 1 < < KIND_SHIFT ,
MATX = 2 < < KIND_SHIFT , STD_VECTOR = 3 < < KIND_SHIFT ,
STD_VECTOR_VECTOR = 4 < < KIND_SHIFT ,
STD_VECTOR_MAT = 5 < < KIND_SHIFT , EXPR = 6 < < KIND_SHIFT } ;
InputArray ( ) ;
InputArray ( const Mat & m ) ;
InputArray ( const MatExpr & expr ) ;
template < typename _Tp > InputArray ( const vector < _Tp > & vec ) ;
template < typename _Tp > InputArray ( const vector < vector < _Tp > > & vec ) ;
InputArray ( const vector < Mat > & vec ) ;
template < typename _Tp , int m , int n > InputArray ( const Matx < _Tp , m , n > & matx ) ;
InputArray ( const double & val ) ;
Mat getMat ( int i = - 1 ) const ;
void getMatVector ( vector < Mat > & mv ) const ;
int kind ( ) const ;
Size size ( int i = - 1 ) const ;
size_t total ( int i = - 1 ) const ;
int type ( int i = - 1 ) const ;
int depth ( int i = - 1 ) const ;
int channels ( int i = - 1 ) const ;
bool empty ( ) const ;
int flags ;
void * obj ;
Size sz ;
} ;
enum
{
DEPTH_MASK_8U = 1 < < CV_8U ,
DEPTH_MASK_8S = 1 < < CV_8S ,
DEPTH_MASK_16U = 1 < < CV_16U ,
DEPTH_MASK_16S = 1 < < CV_16S ,
DEPTH_MASK_32S = 1 < < CV_32S ,
DEPTH_MASK_32F = 1 < < CV_32F ,
DEPTH_MASK_64F = 1 < < CV_64F ,
DEPTH_MASK_ALL = ( DEPTH_MASK_64F < < 1 ) - 1 ,
DEPTH_MASK_ALL_BUT_8S = DEPTH_MASK_ALL & ~ DEPTH_MASK_8S ,
DEPTH_MASK_FLT = DEPTH_MASK_32F + DEPTH_MASK_64F
} ;
/*!
Proxy datatype for passing Mat ' s and vector < > ' s as input parameters
*/
class CV_EXPORTS OutputArray : public InputArray
{
public :
OutputArray ( ) ;
OutputArray ( Mat & m ) ;
template < typename _Tp > OutputArray ( vector < _Tp > & vec ) ;
template < typename _Tp > OutputArray ( vector < vector < _Tp > > & vec ) ;
OutputArray ( vector < Mat > & vec ) ;
template < typename _Tp , int m , int n > OutputArray ( Matx < _Tp , m , n > & matx ) ;
bool fixedSize ( ) const ;
bool fixedType ( ) const ;
bool needed ( ) const ;
Mat & getMatRef ( int i = - 1 ) ;
void create ( Size sz , int type , int i = - 1 , bool allocateVector = false , int fixedDepthMask = 0 ) ;
void create ( int rows , int cols , int type , int i = - 1 , bool allowTransposed = false , int fixedDepthMask = 0 ) ;
void create ( int dims , const int * size , int type , int i = - 1 , bool allowTransposed = false , int fixedDepthMask = 0 ) ;
void release ( ) ;
void clear ( ) ;
} ;
typedef InputArray InputArrayOfArrays ;
typedef OutputArray OutputArrayOfArrays ;
typedef OutputArray InputOutputArray ;
/////////////////////////////////////// Mat ///////////////////////////////////////////
enum { MAGIC_MASK = 0xFFFF0000 , TYPE_MASK = 0x00000FFF , DEPTH_MASK = 7 } ;
enum { MAGIC_MASK = 0xFFFF0000 , TYPE_MASK = 0x00000FFF , DEPTH_MASK = 7 } ;
@ -1563,19 +1645,18 @@ public:
Mat clone ( ) const ;
Mat clone ( ) const ;
//! copies the matrix content to "m".
//! copies the matrix content to "m".
// It calls m.create(this->size(), this->type()).
// It calls m.create(this->size(), this->type()).
void copyTo ( Mat & m ) const ;
void copyTo ( OutputArray m ) const ;
template < typename _Tp > void copyTo ( vector < _Tp > & v ) const ;
//! copies those matrix elements to "m" that are marked with non-zero mask elements.
//! copies those matrix elements to "m" that are marked with non-zero mask elements.
void copyTo ( Mat & m , const Mat & mask ) const ;
void copyTo ( OutputArray m , const InputArray & mask ) const ;
//! converts matrix to another datatype with optional scalng. See cvConvertScale.
//! converts matrix to another datatype with optional scalng. See cvConvertScale.
void convertTo ( Mat & m , int rtype , double alpha = 1 , double beta = 0 ) const ;
void convertTo ( OutputArray m , int rtype , double alpha = 1 , double beta = 0 ) const ;
void assignTo ( Mat & m , int type = - 1 ) const ;
void assignTo ( Mat & m , int type = - 1 ) const ;
//! sets every matrix element to s
//! sets every matrix element to s
Mat & operator = ( const Scalar & s ) ;
Mat & operator = ( const Scalar & s ) ;
//! sets some of the matrix elements to s, according to the mask
//! sets some of the matrix elements to s, according to the mask
Mat & setTo ( const Scalar & s , const Mat & mask = Mat ( ) ) ;
Mat & setTo ( const Scalar & s , const InputArray & mask = InputArray ( ) ) ;
//! creates alternative matrix header for the same data, with different
//! creates alternative matrix header for the same data, with different
// number of channels and/or different number of rows. see cvReshape.
// number of channels and/or different number of rows. see cvReshape.
Mat reshape ( int _cn , int _rows = 0 ) const ;
Mat reshape ( int _cn , int _rows = 0 ) const ;
@ -1586,13 +1667,13 @@ public:
//! matrix inversion by means of matrix expressions
//! matrix inversion by means of matrix expressions
MatExpr inv ( int method = DECOMP_LU ) const ;
MatExpr inv ( int method = DECOMP_LU ) const ;
//! per-element matrix multiplication by means of matrix expressions
//! per-element matrix multiplication by means of matrix expressions
MatExpr mul ( const Mat & m , double scale = 1 ) const ;
MatExpr mul ( const InputArray & m , double scale = 1 ) const ;
MatExpr mul ( const MatExpr & m , double scale = 1 ) const ;
MatExpr mul ( const MatExpr & m , double scale = 1 ) const ;
//! computes cross-product of 2 3D vectors
//! computes cross-product of 2 3D vectors
Mat cross ( const Mat & m ) const ;
Mat cross ( const InputArray & m ) const ;
//! computes dot-product
//! computes dot-product
double dot ( const Mat & m ) const ;
double dot ( const InputArray & m ) const ;
//! Matlab-style matrix initialization
//! Matlab-style matrix initialization
static MatExpr zeros ( int rows , int cols , int type ) ;
static MatExpr zeros ( int rows , int cols , int type ) ;
@ -1842,7 +1923,7 @@ public:
float uniform ( float a , float b ) ;
float uniform ( float a , float b ) ;
//! returns uniformly distributed double-precision floating-point random number from [a,b) range
//! returns uniformly distributed double-precision floating-point random number from [a,b) range
double uniform ( double a , double b ) ;
double uniform ( double a , double b ) ;
void fill ( Mat & mat , int distType , const Scalar & a , const Scalar & b ) ;
void fill ( InputOutputArray mat , int distType , const InputArray & a , const InputArray & b ) ;
//! returns Gaussian random variate with mean zero.
//! returns Gaussian random variate with mean zero.
double gaussian ( double sigma ) ;
double gaussian ( double sigma ) ;
@ -1850,8 +1931,6 @@ public:
} ;
} ;
/*!
/*!
Termination criteria in iterative algorithms
Termination criteria in iterative algorithms
*/
*/
@ -1879,6 +1958,7 @@ public:
double epsilon ; // the desired accuracy
double epsilon ; // the desired accuracy
} ;
} ;
//! swaps two matrices
//! swaps two matrices
CV_EXPORTS void swap ( Mat & a , Mat & b ) ;
CV_EXPORTS void swap ( Mat & a , Mat & b ) ;
@ -1886,79 +1966,75 @@ CV_EXPORTS void swap(Mat& a, Mat& b);
CV_EXPORTS Mat cvarrToMat ( const CvArr * arr , bool copyData = false ,
CV_EXPORTS Mat cvarrToMat ( const CvArr * arr , bool copyData = false ,
bool allowND = true , int coiMode = 0 ) ;
bool allowND = true , int coiMode = 0 ) ;
//! extracts Channel of Interest from CvMat or IplImage and makes cv::Mat out of it.
//! extracts Channel of Interest from CvMat or IplImage and makes cv::Mat out of it.
CV_EXPORTS void extractImageCOI ( const CvArr * arr , CV_OUT Mat & coiimg , int coi = - 1 ) ;
CV_EXPORTS void extractImageCOI ( const CvArr * arr , OutputArray coiimg , int coi = - 1 ) ;
//! inserts single-channel cv::Mat into a multi-channel CvMat or IplImage
//! inserts single-channel cv::Mat into a multi-channel CvMat or IplImage
CV_EXPORTS void insertImageCOI ( const Mat & coiimg , CvArr * arr , int coi = - 1 ) ;
CV_EXPORTS void insertImageCOI ( const InputArray & coiimg , CvArr * arr , int coi = - 1 ) ;
//! adds one matrix to another (dst = src1 + src2)
//! adds one matrix to another (dst = src1 + src2)
CV_EXPORTS_W void add ( const Mat & src1 , const Mat & src2 , CV_OUT Mat & dst , const Mat & mask CV_WRAP_DEFAULT ( Mat ( ) ) ) ;
CV_EXPORTS_W void add ( const InputArray & src1 , const InputArray & src2 , OutputArray dst ,
const InputArray & mask = InputArray ( ) , int dtype = - 1 ) ;
//! subtracts one matrix from another (dst = src1 - src2)
//! subtracts one matrix from another (dst = src1 - src2)
CV_EXPORTS_W void subtract ( const Mat & src1 , const Mat & src2 , CV_OUT Mat & dst , const Mat & mask CV_WRAP_DEFAULT ( Mat ( ) ) ) ;
CV_EXPORTS_W void subtract ( const InputArray & src1 , const InputArray & src2 , OutputArray dst ,
//! adds one matrix to another (dst = src1 + src2)
const InputArray & mask = InputArray ( ) , int dtype = - 1 ) ;
CV_EXPORTS void add ( const Mat & src1 , const Mat & src2 , CV_OUT Mat & dst ) ;
//! subtracts one matrix from another (dst = src1 - src2)
CV_EXPORTS void subtract ( const Mat & src1 , const Mat & src2 , CV_OUT Mat & dst ) ;
//! adds scalar to a matrix (dst = src1 + src2)
CV_EXPORTS_W void add ( const Mat & src1 , const Scalar & src2 , CV_OUT Mat & dst , const Mat & mask = Mat ( ) ) ;
//! subtracts scalar from a matrix (dst = src1 - src2)
CV_EXPORTS_W void subtract ( const Mat & src1 , const Scalar & src2 , CV_OUT Mat & dst , const Mat & mask = Mat ( ) ) ;
//! subtracts matrix from scalar (dst = src1 - src2)
CV_EXPORTS_W void subtract ( const Scalar & src1 , const Mat & src2 , CV_OUT Mat & dst , const Mat & mask = Mat ( ) ) ;
//! computes element-wise weighted product of the two arrays (dst = scale*src1*src2)
//! computes element-wise weighted product of the two arrays (dst = scale*src1*src2)
CV_EXPORTS_W void multiply ( const Mat & src1 , const Mat & src2 , CV_OUT Mat & dst , double scale = 1 ) ;
CV_EXPORTS_W void multiply ( const InputArray & src1 , const InputArray & src2 ,
OutputArray dst , double scale = 1 , int dtype = - 1 ) ;
//! computes element-wise weighted quotient of the two arrays (dst = scale*src1/src2)
//! computes element-wise weighted quotient of the two arrays (dst = scale*src1/src2)
CV_EXPORTS_W void divide ( const Mat & src1 , const Mat & src2 , CV_OUT Mat & dst , double scale = 1 ) ;
CV_EXPORTS_W void divide ( const InputArray & src1 , const InputArray & src2 , OutputArray dst ,
double scale = 1 , int dtype = - 1 ) ;
//! computes element-wise weighted reciprocal of an array (dst = scale/src2)
//! computes element-wise weighted reciprocal of an array (dst = scale/src2)
CV_EXPORTS_W void divide ( double scale , const Mat & src2 , CV_OUT Mat & dst ) ;
CV_EXPORTS_W void divide ( double scale , const InputArray & src2 ,
OutputArray dst , int dtype = - 1 ) ;
//! adds scaled array to another one (dst = alpha*src1 + src2)
//! adds scaled array to another one (dst = alpha*src1 + src2)
CV_EXPORTS_W void scaleAdd ( const Mat & src1 , double alpha , const Mat & src2 , CV_OUT Mat & dst ) ;
CV_EXPORTS_W void scaleAdd ( const InputArray & src1 , double alpha , const InputArray & src2 , OutputArray dst ) ;
//! computes weighted sum of two arrays (dst = alpha*src1 + beta*src2 + gamma)
//! computes weighted sum of two arrays (dst = alpha*src1 + beta*src2 + gamma)
CV_EXPORTS_W void addWeighted ( const Mat & src1 , double alpha , const Mat & src2 ,
CV_EXPORTS_W void addWeighted ( const InputArray & src1 , double alpha , const InputArray & src2 ,
double beta , double gamma , CV_OUT Mat & dst ) ;
double beta , double gamma , OutputArray dst , int dtype = - 1 ) ;
//! scales array elements, computes absolute values and converts the results to 8-bit unsigned integers: dst(i)=saturate_cast<uchar>abs(src(i)*alpha+beta)
//! scales array elements, computes absolute values and converts the results to 8-bit unsigned integers: dst(i)=saturate_cast<uchar>abs(src(i)*alpha+beta)
CV_EXPORTS_W void convertScaleAbs ( const Mat & src , CV_OUT Mat & dst , double alpha = 1 , double beta = 0 ) ;
CV_EXPORTS_W void convertScaleAbs ( const InputArray & src , OutputArray dst ,
//! transforms 8-bit unsigned integers using lookup table: dst(i)=lut(src(i))
double alpha = 1 , double beta = 0 ) ;
CV_EXPORTS_W void LUT ( const Mat & src , const Mat & lut , CV_OUT Mat & dst ) ;
//! transforms array of numbers using a lookup table: dst(i)=lut(src(i))
CV_EXPORTS_W void LUT ( const InputArray & src , const InputArray & lut , OutputArray dst ,
int interpolation = 0 ) ;
//! computes sum of array elements
//! computes sum of array elements
CV_EXPORTS_W Scalar sum ( const Mat & src ) ;
CV_EXPORTS_W Scalar sum ( const InputArray & src ) ;
//! computes the number of nonzero array elements
//! computes the number of nonzero array elements
CV_EXPORTS_W int countNonZero ( const Mat & src ) ;
CV_EXPORTS_W int countNonZero ( const InputArray & src ) ;
//! computes mean value of array elements
CV_EXPORTS Scalar mean ( const Mat & src ) ;
//! computes mean value of selected array elements
//! computes mean value of selected array elements
CV_EXPORTS_W Scalar mean ( const Mat & src , const Mat & mask CV_WRAP_DEFAULT ( Mat ( ) ) ) ;
CV_EXPORTS_W Scalar mean ( const InputArray & src , const InputArray & mask = InputArray ( ) ) ;
//! computes mean value and standard deviation of all or selected array elements
//! computes mean value and standard deviation of all or selected array elements
CV_EXPORTS_W void meanStdDev ( const Mat & src , CV_OUT Scalar & mean , CV_OUT Scalar & stddev , const Mat & mask = Mat ( ) ) ;
CV_EXPORTS_W void meanStdDev ( const InputArray & src , OutputArray mean , OutputArray stddev ,
//! computes norm of array
const InputArray & mask = InputArray ( ) ) ;
CV_EXPORTS double norm ( const Mat & src1 , int normType = NORM_L2 ) ;
//! computes norm of the difference between two arrays
CV_EXPORTS double norm ( const Mat & src1 , const Mat & src2 , int normType = NORM_L2 ) ;
//! computes norm of the selected array part
//! computes norm of the selected array part
CV_EXPORTS_W double norm ( const Mat & src1 , int normType , const Mat & mask CV_WRAP_DEFAULT ( Mat ( ) ) ) ;
CV_EXPORTS_W double norm ( const InputArray & src1 , int normType = NORM_L2 , const InputArray & mask = InputArray ( ) ) ;
//! computes norm of selected part of the difference between two arrays
//! computes norm of selected part of the difference between two arrays
CV_EXPORTS_W double norm ( const Mat & src1 , const Mat & src2 ,
CV_EXPORTS_W double norm ( const InputArray & src1 , const InputArray & src2 ,
int normType , const Mat & mask CV_WRAP_DEFAULT ( Mat ( ) ) ) ;
int normType = NORM_L2 , const InputArray & mask = InputArray ( ) ) ;
//! scales and shifts array elements so that either the specified norm (alpha) or the minimum (alpha) and maximum (beta) array values get the specified values
//! scales and shifts array elements so that either the specified norm (alpha) or the minimum (alpha) and maximum (beta) array values get the specified values
CV_EXPORTS_W void normalize ( const Mat & src , CV_OUT Mat & dst , double alpha = 1 , double beta = 0 ,
CV_EXPORTS_W void normalize ( const InputArray & src , OutputArray dst , double alpha = 1 , double beta = 0 ,
int norm_type = NORM_L2 , int r type= - 1 , const Mat & mask = Mat ( ) ) ;
int norm_type = NORM_L2 , int d type= - 1 , const InputArray & mask = InputArray ( ) ) ;
//! finds global minimum and maximum array elements and returns their values and their locations
//! finds global minimum and maximum array elements and returns their values and their locations
CV_EXPORTS_W void minMaxLoc ( const Mat & src , CV_OUT double * minVal ,
CV_EXPORTS_W void minMaxLoc ( const InputArray & src , CV_OUT double * minVal ,
CV_OUT double * maxVal = 0 , CV_OUT Point * minLoc = 0 ,
CV_OUT double * maxVal = 0 , CV_OUT Point * minLoc = 0 ,
CV_OUT Point * maxLoc = 0 , const Mat & mask = Mat ( ) ) ;
CV_OUT Point * maxLoc = 0 , const InputArray & mask = InputArray ( ) ) ;
CV_EXPORTS void minMaxIdx ( const Mat & src , double * minVal , double * maxVal ,
CV_EXPORTS void minMaxIdx ( const InputArray & src , double * minVal , double * maxVal ,
int * minIdx = 0 , int * maxIdx = 0 , const Mat & mask = Mat ( ) ) ;
int * minIdx = 0 , int * maxIdx = 0 , const InputArray & mask = InputArray ( ) ) ;
//! transforms 2D matrix to 1D row or column vector by taking sum, minimum, maximum or mean value over all the rows
//! transforms 2D matrix to 1D row or column vector by taking sum, minimum, maximum or mean value over all the rows
CV_EXPORTS_W void reduce ( const Mat & src , CV_OUT Mat & dst , int dim , int rtype , int dtype = - 1 ) ;
CV_EXPORTS_W void reduce ( const InputArray & src , OutputArray dst , int dim , int rtype , int dtype = - 1 ) ;
//! makes multi-channel array out of several single-channel arrays
//! makes multi-channel array out of several single-channel arrays
CV_EXPORTS void merge ( const Mat * mv , size_t count , CV_OUT Mat & dst ) ;
CV_EXPORTS void merge ( const Mat * mv , size_t count , OutputArray dst ) ;
//! makes multi-channel array out of several single-channel arrays
//! makes multi-channel array out of several single-channel arrays
CV_EXPORTS_W void merge ( const vector < Mat > & mv , Mat & dst ) ;
CV_EXPORTS_W void merge ( const vector < Mat > & mv , OutputArray dst ) ;
//! copies each plane of a multi-channel array to a dedicated array
//! copies each plane of a multi-channel array to a dedicated array
CV_EXPORTS void split ( const Mat & src , Mat * mvbegin ) ;
CV_EXPORTS void split ( const Mat & src , Mat * mvbegin ) ;
@ -1969,133 +2045,131 @@ CV_EXPORTS_W void split(const Mat& m, vector<Mat>& mv);
CV_EXPORTS void mixChannels ( const Mat * src , size_t nsrcs , Mat * dst , size_t ndsts ,
CV_EXPORTS void mixChannels ( const Mat * src , size_t nsrcs , Mat * dst , size_t ndsts ,
const int * fromTo , size_t npairs ) ;
const int * fromTo , size_t npairs ) ;
CV_EXPORTS void mixChannels ( const vector < Mat > & src , vector < Mat > & dst ,
CV_EXPORTS void mixChannels ( const vector < Mat > & src , vector < Mat > & dst ,
const int * fromTo , in t npairs ) ;
const int * fromTo , size_ t npairs ) ;
//! reverses the order of the rows, columns or both in a matrix
//! reverses the order of the rows, columns or both in a matrix
CV_EXPORTS_W void flip ( const Mat & src , CV_OUT Mat & dst , int flipCode ) ;
CV_EXPORTS_W void flip ( const InputArray & src , OutputArray dst , int flipCode ) ;
//! replicates the input matrix the specified number of times in the horizontal and/or vertical direction
//! replicates the input matrix the specified number of times in the horizontal and/or vertical direction
CV_EXPORTS_W void repeat ( const Mat & src , int ny , int nx , CV_OUT Mat & dst ) ;
CV_EXPORTS_W void repeat ( const InputArray & src , int ny , int nx , OutputArray dst ) ;
CV_EXPORTS Mat repeat ( const Mat & src , int ny , int nx ) ;
CV_EXPORTS Mat repeat ( const Mat & src , int ny , int nx ) ;
CV_EXPORTS void hconcat ( const Mat * src , size_t nsrc , Mat & dst ) ;
CV_EXPORTS void hconcat ( const Mat * src , size_t nsrc , OutputArray dst ) ;
CV_EXPORTS void hconcat ( const Mat & src1 , const Mat & src2 , Mat & dst ) ;
CV_EXPORTS void hconcat ( const InputArray & src1 , const InputArray & src2 , OutputArray dst ) ;
CV_EXPORTS_W void hconcat ( const vector < Mat > & src , CV_OUT Mat & dst ) ;
CV_EXPORTS_W void hconcat ( const InputArray & src , OutputArray dst ) ;
CV_EXPORTS void vconcat ( const Mat * src , size_t nsrc , Mat & dst ) ;
CV_EXPORTS void vconcat ( const Mat * src , size_t nsrc , OutputArray dst ) ;
CV_EXPORTS void vconcat ( const Mat & src1 , const Mat & src2 , Mat & dst ) ;
CV_EXPORTS void vconcat ( const InputArray & src1 , const InputArray & src2 , OutputArray dst ) ;
CV_EXPORTS_W void vconcat ( const vector < Mat > & src , CV_OUT Mat & dst ) ;
CV_EXPORTS_W void vconcat ( const InputArray & src , OutputArray dst ) ;
//! computes bitwise conjunction of the two arrays (dst = src1 & src2)
//! computes bitwise conjunction of the two arrays (dst = src1 & src2)
CV_EXPORTS_W void bitwise_and ( const Mat & src1 , const Mat & src2 , CV_OUT Mat & dst , const Mat & mask = Mat ( ) ) ;
CV_EXPORTS_W void bitwise_and ( const InputArray & src1 , const InputArray & src2 ,
OutputArray dst , const InputArray & mask = InputArray ( ) ) ;
//! computes bitwise disjunction of the two arrays (dst = src1 | src2)
//! computes bitwise disjunction of the two arrays (dst = src1 | src2)
CV_EXPORTS_W void bitwise_or ( const Mat & src1 , const Mat & src2 , CV_OUT Mat & dst , const Mat & mask = Mat ( ) ) ;
CV_EXPORTS_W void bitwise_or ( const InputArray & src1 , const InputArray & src2 ,
OutputArray dst , const InputArray & mask = InputArray ( ) ) ;
//! computes bitwise exclusive-or of the two arrays (dst = src1 ^ src2)
//! computes bitwise exclusive-or of the two arrays (dst = src1 ^ src2)
CV_EXPORTS_W void bitwise_xor ( const Mat & src1 , const Mat & src2 , CV_OUT Mat & dst , const Mat & mask = Mat ( ) ) ;
CV_EXPORTS_W void bitwise_xor ( const InputArray & src1 , const InputArray & src2 ,
//! computes bitwise conjunction of an array and scalar (dst = src1 & src2)
OutputArray dst , const InputArray & mask = InputArray ( ) ) ;
CV_EXPORTS_W void bitwise_and ( const Mat & src1 , const Scalar & src2 , CV_OUT Mat & dst , const Mat & mask = Mat ( ) ) ;
//! computes bitwise disjunction of an array and scalar (dst = src1 | src2)
CV_EXPORTS_W void bitwise_or ( const Mat & src1 , const Scalar & src2 , CV_OUT Mat & dst , const Mat & mask = Mat ( ) ) ;
//! computes bitwise exclusive-or of an array and scalar (dst = src1 ^ src2)
CV_EXPORTS_W void bitwise_xor ( const Mat & src1 , const Scalar & src2 , CV_OUT Mat & dst , const Mat & mask = Mat ( ) ) ;
//! inverts each bit of array (dst = ~src)
//! inverts each bit of array (dst = ~src)
CV_EXPORTS_W void bitwise_not ( const Mat & src , CV_OUT Mat & dst ) ;
CV_EXPORTS_W void bitwise_not ( const InputArray & src , OutputArray dst ,
const InputArray & mask = InputArray ( ) ) ;
//! computes element-wise absolute difference of two arrays (dst = abs(src1 - src2))
//! computes element-wise absolute difference of two arrays (dst = abs(src1 - src2))
CV_EXPORTS_W void absdiff ( const Mat & src1 , const Mat & src2 , CV_OUT Mat & dst ) ;
CV_EXPORTS_W void absdiff ( const InputArray & src1 , const InputArray & src2 , OutputArray dst ) ;
//! computes element-wise absolute difference of array and scalar (dst = abs(src1 - src2))
CV_EXPORTS_W void absdiff ( const Mat & src1 , const Scalar & src2 , CV_OUT Mat & dst ) ;
//! set mask elements for those array elements which are within the element-specific bounding box (dst = lowerb <= src && src < upperb)
//! set mask elements for those array elements which are within the element-specific bounding box (dst = lowerb <= src && src < upperb)
CV_EXPORTS_W void inRange ( const Mat & src , const Mat & lowerb ,
CV_EXPORTS_W void inRange ( const InputArray & src , const InputArray & lowerb ,
const Mat & upperb , CV_OUT Mat & dst ) ;
const InputArray & upperb , OutputArray dst ) ;
//! set mask elements for those array elements which are within the fixed bounding box (dst = lowerb <= src && src < upperb)
CV_EXPORTS_W void inRange ( const Mat & src , const Scalar & lowerb ,
const Scalar & upperb , CV_OUT Mat & dst ) ;
//! compares elements of two arrays (dst = src1 <cmpop> src2)
//! compares elements of two arrays (dst = src1 <cmpop> src2)
CV_EXPORTS_W void compare ( const Mat & src1 , const Mat & src2 , CV_OUT Mat & dst , int cmpop ) ;
CV_EXPORTS_W void compare ( const InputArray & src1 , const InputArray & src2 , OutputArray dst , int cmpop ) ;
//! compares elements of array with scalar (dst = src1 <cmpop> src2)
//! computes per-element minimum of two arrays (dst = min(src1, src2))
CV_EXPORTS_W void compare ( const Mat & src1 , double s , CV_OUT Mat & dst , int cmpop ) ;
CV_EXPORTS_W void min ( const InputArray & src1 , const InputArray & src2 , OutputArray dst ) ;
//! computes per-element maximum of two arrays (dst = max(src1, src2))
CV_EXPORTS_W void max ( const InputArray & src1 , const InputArray & src2 , OutputArray dst ) ;
//! computes per-element minimum of two arrays (dst = min(src1, src2))
//! computes per-element minimum of two arrays (dst = min(src1, src2))
CV_EXPORTS_W void min ( const Mat & src1 , const Mat & src2 , CV_OUT Mat & dst ) ;
CV_EXPORTS void min ( const Mat & src1 , const Mat & src2 , Mat & dst ) ;
//! computes per-element minimum of array and scalar (dst = min(src1, src2))
//! computes per-element minimum of array and scalar (dst = min(src1, src2))
CV_EXPORTS_W void min ( const Mat & src1 , double src2 , CV_OUT Mat & dst ) ;
CV_EXPORTS void min ( const Mat & src1 , double src2 , Mat & dst ) ;
//! computes per-element maximum of two arrays (dst = max(src1, src2))
//! computes per-element maximum of two arrays (dst = max(src1, src2))
CV_EXPORTS_W void max ( const Mat & src1 , const Mat & src2 , CV_OUT Mat & dst ) ;
CV_EXPORTS void max ( const Mat & src1 , const Mat & src2 , Mat & dst ) ;
//! computes per-element maximum of array and scalar (dst = max(src1, src2))
//! computes per-element maximum of array and scalar (dst = max(src1, src2))
CV_EXPORTS_W void max ( const Mat & src1 , double src2 , CV_OUT Mat & dst ) ;
CV_EXPORTS void max ( const Mat & src1 , double src2 , Mat & dst ) ;
//! computes square root of each matrix element (dst = src**0.5)
//! computes square root of each matrix element (dst = src**0.5)
CV_EXPORTS_W void sqrt ( const Mat & src , CV_OUT Mat & dst ) ;
CV_EXPORTS_W void sqrt ( const InputArray & src , OutputArray dst ) ;
//! raises the input matrix elements to the specified power (b = a**power)
//! raises the input matrix elements to the specified power (b = a**power)
CV_EXPORTS_W void pow ( const Mat & src , double power , CV_OUT Mat & dst ) ;
CV_EXPORTS_W void pow ( const InputArray & src , double power , OutputArray dst ) ;
//! computes exponent of each matrix element (dst = e**src)
//! computes exponent of each matrix element (dst = e**src)
CV_EXPORTS_W void exp ( const Mat & src , CV_OUT Mat & dst ) ;
CV_EXPORTS_W void exp ( const InputArray & src , OutputArray dst ) ;
//! computes natural logarithm of absolute value of each matrix element: dst = log(abs(src))
//! computes natural logarithm of absolute value of each matrix element: dst = log(abs(src))
CV_EXPORTS_W void log ( const Mat & src , CV_OUT Mat & dst ) ;
CV_EXPORTS_W void log ( const InputArray & src , OutputArray dst ) ;
//! computes cube root of the argument
//! computes cube root of the argument
CV_EXPORTS_W float cubeRoot ( float val ) ;
CV_EXPORTS_W float cubeRoot ( float val ) ;
//! computes the angle in degrees (0..360) of the vector (x,y)
//! computes the angle in degrees (0..360) of the vector (x,y)
CV_EXPORTS_W float fastAtan2 ( float y , float x ) ;
CV_EXPORTS_W float fastAtan2 ( float y , float x ) ;
//! converts polar coordinates to Cartesian
//! converts polar coordinates to Cartesian
CV_EXPORTS_W void polarToCart ( const Mat & magnitude , const Mat & angle ,
CV_EXPORTS_W void polarToCart ( const InputArray & magnitude , const InputArray & angle ,
CV_OUT Mat & x , CV_OUT Mat & y , bool angleInDegrees = false ) ;
OutputArray x , OutputArray y , bool angleInDegrees = false ) ;
//! converts Cartesian coordinates to polar
//! converts Cartesian coordinates to polar
CV_EXPORTS_W void cartToPolar ( const Mat & x , const Mat & y ,
CV_EXPORTS_W void cartToPolar ( const InputArray & x , const InputArray & y ,
CV_OUT Mat & magnitude , CV_OUT Mat & angle ,
OutputArray magnitude , OutputArray angle ,
bool angleInDegrees = false ) ;
bool angleInDegrees = false ) ;
//! computes angle (angle(i)) of each (x(i), y(i)) vector
//! computes angle (angle(i)) of each (x(i), y(i)) vector
CV_EXPORTS_W void phase ( const Mat & x , const Mat & y , CV_OUT Mat & angle ,
CV_EXPORTS_W void phase ( const InputArray & x , const InputArray & y , OutputArray angle ,
bool angleInDegrees = false ) ;
bool angleInDegrees = false ) ;
//! computes magnitude (magnitude(i)) of each (x(i), y(i)) vector
//! computes magnitude (magnitude(i)) of each (x(i), y(i)) vector
CV_EXPORTS_W void magnitude ( const Mat & x , const Mat & y , CV_OUT Mat & magnitude ) ;
CV_EXPORTS_W void magnitude ( const InputArray & x , const InputArray & y , OutputArray magnitude ) ;
//! checks that each matrix element is within the specified range.
//! checks that each matrix element is within the specified range.
CV_EXPORTS_W bool checkRange ( const Mat & a , bool quiet = true , CV_OUT Point * pt = 0 ,
CV_EXPORTS_W bool checkRange ( const InputArray & a , bool quiet = true , CV_OUT Point * pt = 0 ,
double minVal = - DBL_MAX , double maxVal = DBL_MAX ) ;
double minVal = - DBL_MAX , double maxVal = DBL_MAX ) ;
//! implements generalized matrix product algorithm GEMM from BLAS
//! implements generalized matrix product algorithm GEMM from BLAS
CV_EXPORTS_W void gemm ( const Mat & src1 , const Mat & src2 , double alpha ,
CV_EXPORTS_W void gemm ( const InputArray & src1 , const InputArray & src2 , double alpha ,
const Mat & src3 , double gamma , CV_OUT Mat & dst , int flags = 0 ) ;
const InputArray & src3 , double gamma , OutputArray dst , int flags = 0 ) ;
//! multiplies matrix by its transposition from the left or from the right
//! multiplies matrix by its transposition from the left or from the right
CV_EXPORTS_W void mulTransposed ( const Mat & src , CV_OUT Mat & dst , bool aTa ,
CV_EXPORTS_W void mulTransposed ( const InputArray & src , OutputArray dst , bool aTa ,
const Mat & delta = Mat ( ) ,
const InputArray & delta = InputArray ( ) ,
double scale = 1 , int r type= - 1 ) ;
double scale = 1 , int d type= - 1 ) ;
//! transposes the matrix
//! transposes the matrix
CV_EXPORTS_W void transpose ( const Mat & src , CV_OUT Mat & dst ) ;
CV_EXPORTS_W void transpose ( const InputArray & src , OutputArray dst ) ;
//! performs affine transformation of each element of multi-channel input matrix
//! performs affine transformation of each element of multi-channel input matrix
CV_EXPORTS_W void transform ( const Mat & src , CV_OUT Mat & dst , const Mat & m ) ;
CV_EXPORTS_W void transform ( const InputArray & src , OutputArray dst , const InputArray & m ) ;
//! performs perspective transformation of each element of multi-channel input matrix
//! performs perspective transformation of each element of multi-channel input matrix
CV_EXPORTS_W void perspectiveTransform ( const Mat & src , CV_OUT Mat & dst , const Mat & m ) ;
CV_EXPORTS_W void perspectiveTransform ( const InputArray & src , OutputArray dst , const InputArray & m ) ;
//! extends the symmetrical matrix from the lower half or from the upper half
//! extends the symmetrical matrix from the lower half or from the upper half
CV_EXPORTS_W void completeSymm ( Mat & mtx , bool lowerToUpper = false ) ;
CV_EXPORTS_W void completeSymm ( InputOutputArray mtx , bool lowerToUpper = false ) ;
//! initializes scaled identity matrix
//! initializes scaled identity matrix
CV_EXPORTS_W void setIdentity ( Mat & mtx , const Scalar & s = Scalar ( 1 ) ) ;
CV_EXPORTS_W void setIdentity ( InputOutputArray mtx , const Scalar & s = Scalar ( 1 ) ) ;
//! computes determinant of a square matrix
//! computes determinant of a square matrix
CV_EXPORTS_W double determinant ( const Mat & mtx ) ;
CV_EXPORTS_W double determinant ( const InputArray & mtx ) ;
//! computes trace of a matrix
//! computes trace of a matrix
CV_EXPORTS_W Scalar trace ( const Mat & mtx ) ;
CV_EXPORTS_W Scalar trace ( const InputArray & mtx ) ;
//! computes inverse or pseudo-inverse matrix
//! computes inverse or pseudo-inverse matrix
CV_EXPORTS_W double invert ( const Mat & src , CV_OUT Mat & dst , int flags = DECOMP_LU ) ;
CV_EXPORTS_W double invert ( const InputArray & src , OutputArray dst , int flags = DECOMP_LU ) ;
//! solves linear system or a least-square problem
//! solves linear system or a least-square problem
CV_EXPORTS_W bool solve ( const Mat & src1 , const Mat & src2 , CV_OUT Mat & dst , int flags = DECOMP_LU ) ;
CV_EXPORTS_W bool solve ( const InputArray & src1 , const InputArray & src2 ,
OutputArray dst , int flags = DECOMP_LU ) ;
//! sorts independently each matrix row or each matrix column
//! sorts independently each matrix row or each matrix column
CV_EXPORTS_W void sort ( const Mat & src , CV_OUT Mat & dst , int flags ) ;
CV_EXPORTS_W void sort ( const InputArray & src , OutputArray dst , int flags ) ;
//! sorts independently each matrix row or each matrix column
//! sorts independently each matrix row or each matrix column
CV_EXPORTS_W void sortIdx ( const Mat & src , CV_OUT Mat & dst , int flags ) ;
CV_EXPORTS_W void sortIdx ( const InputArray & src , OutputArray dst , int flags ) ;
//! finds real roots of a cubic polynomial
//! finds real roots of a cubic polynomial
CV_EXPORTS_W int solveCubic ( const Mat & coeffs , CV_OUT Mat & roots ) ;
CV_EXPORTS_W int solveCubic ( const InputArray & coeffs , OutputArray roots ) ;
//! finds real and complex roots of a polynomial
//! finds real and complex roots of a polynomial
CV_EXPORTS_W double solvePoly ( const Mat & coeffs , CV_OUT Mat & roots , int maxIters = 300 ) ;
CV_EXPORTS_W double solvePoly ( const InputArray & coeffs , OutputArray roots , int maxIters = 300 ) ;
//! finds eigenvalues of a symmetric matrix
//! finds eigenvalues of a symmetric matrix
CV_EXPORTS bool eigen ( const Mat & src , CV_OUT Mat & eigenvalues , int lowindex = - 1 ,
CV_EXPORTS bool eigen ( const InputArray & src , OutputArray eigenvalues , int lowindex = - 1 ,
int highindex = - 1 ) ;
int highindex = - 1 ) ;
//! finds eigenvalues and eigenvectors of a symmetric matrix
//! finds eigenvalues and eigenvectors of a symmetric matrix
CV_EXPORTS bool eigen ( const Mat & src , CV_OUT Mat & eigenvalues , CV_OUT Mat & eigenvectors ,
CV_EXPORTS bool eigen ( const InputArray & src , OutputArray eigenvalues ,
OutputArray eigenvectors ,
int lowindex = - 1 , int highindex = - 1 ) ;
int lowindex = - 1 , int highindex = - 1 ) ;
//! computes covariation matrix of a set of samples
//! computes covariation matrix of a set of samples
CV_EXPORTS void calcCovarMatrix ( const Mat * samples , int nsamples , Mat & covar , Mat & mean ,
CV_EXPORTS void calcCovarMatrix ( const Mat * samples , int nsamples , Mat & covar , Mat & mean ,
int flags , int ctype = CV_64F ) ;
int flags , int ctype = CV_64F ) ;
//! computes covariation matrix of a set of samples
//! computes covariation matrix of a set of samples
CV_EXPORTS_W void calcCovarMatrix ( const Mat & samples , CV_OUT Mat & covar , CV_OUT Mat & mean ,
CV_EXPORTS_W void calcCovarMatrix ( const InputArray & samples , OutputArray covar ,
int flags , int ctype = CV_64F ) ;
OutputArray mean , int flags , int ctype = CV_64F ) ;
/*!
/*!
Principal Component Analysis
Principal Component Analysis
@ -2157,17 +2231,17 @@ public:
//! default constructor
//! default constructor
PCA ( ) ;
PCA ( ) ;
//! the constructor that performs PCA
//! the constructor that performs PCA
PCA ( const Mat & data , const Mat & mean , int flags , int maxComponents = 0 ) ;
PCA ( const InputArray & data , const InputArray & mean , int flags , int maxComponents = 0 ) ;
//! operator that performs PCA. The previously stored data, if any, is released
//! operator that performs PCA. The previously stored data, if any, is released
PCA & operator ( ) ( const Mat & data , const Mat & mean , int flags , int maxComponents = 0 ) ;
PCA & operator ( ) ( const InputArray & data , const InputArray & mean , int flags , int maxComponents = 0 ) ;
//! projects vector from the original space to the principal components subspace
//! projects vector from the original space to the principal components subspace
Mat project ( const Mat & vec ) const ;
Mat project ( const InputArray & vec ) const ;
//! projects vector from the original space to the principal components subspace
//! projects vector from the original space to the principal components subspace
void project ( const Mat & vec , CV_OUT Mat & result ) const ;
void project ( const InputArray & vec , OutputArray result ) const ;
//! reconstructs the original vector from the projection
//! reconstructs the original vector from the projection
Mat backProject ( const Mat & vec ) const ;
Mat backProject ( const InputArray & vec ) const ;
//! reconstructs the original vector from the projection
//! reconstructs the original vector from the projection
void backProject ( const Mat & vec , CV_OUT Mat & result ) const ;
void backProject ( const InputArray & vec , OutputArray result ) const ;
Mat eigenvectors ; //!< eigenvectors of the covariation matrix
Mat eigenvectors ; //!< eigenvectors of the covariation matrix
Mat eigenvalues ; //!< eigenvalues of the covariation matrix
Mat eigenvalues ; //!< eigenvalues of the covariation matrix
@ -2194,17 +2268,19 @@ public:
//! the default constructor
//! the default constructor
SVD ( ) ;
SVD ( ) ;
//! the constructor that performs SVD
//! the constructor that performs SVD
SVD ( const Mat & src , int flags = 0 ) ;
SVD ( const InputArray & src , int flags = 0 ) ;
//! the operator that performs SVD. The previously allocated SVD::u, SVD::w are SVD::vt are released.
//! the operator that performs SVD. The previously allocated SVD::u, SVD::w are SVD::vt are released.
SVD & operator ( ) ( const Mat & src , int flags = 0 ) ;
SVD & operator ( ) ( const InputArray & src , int flags = 0 ) ;
//! decomposes matrix and stores the results to user-provided matrices
//! decomposes matrix and stores the results to user-provided matrices
static void compute ( const Mat & src , CV_OUT Mat & w , CV_OUT Mat & u , CV_OUT Mat & vt , int flags = 0 ) ;
static void compute ( const InputArray & src , OutputArray w ,
OutputArray u , OutputArray vt , int flags = 0 ) ;
//! computes singular values of a matrix
//! computes singular values of a matrix
static void compute ( const Mat & src , CV_OUT Mat & w , int flags = 0 ) ;
static void compute ( const InputArray & src , OutputArray w , int flags = 0 ) ;
//! performs back substitution
//! performs back substitution
static void backSubst ( const Mat & w , const Mat & u , const Mat & vt ,
static void backSubst ( const InputArray & w , const InputArray & u ,
const Mat & rhs , CV_OUT Mat & dst ) ;
const InputArray & vt , const InputArray & rhs ,
OutputArray dst ) ;
template < typename _Tp , int m , int n , int nm > static void compute ( const Matx < _Tp , m , n > & a ,
template < typename _Tp , int m , int n , int nm > static void compute ( const Matx < _Tp , m , n > & a ,
Matx < _Tp , nm , 1 > & w , Matx < _Tp , m , nm > & u , Matx < _Tp , n , nm > & vt ) ;
Matx < _Tp , nm , 1 > & w , Matx < _Tp , m , nm > & u , Matx < _Tp , n , nm > & vt ) ;
@ -2214,28 +2290,28 @@ public:
const Matx < _Tp , m , nm > & u , const Matx < _Tp , n , nm > & vt , const Matx < _Tp , m , nb > & rhs , Matx < _Tp , n , nb > & dst ) ;
const Matx < _Tp , m , nm > & u , const Matx < _Tp , n , nm > & vt , const Matx < _Tp , m , nb > & rhs , Matx < _Tp , n , nb > & dst ) ;
//! finds dst = arg min_{|dst|=1} |m*dst|
//! finds dst = arg min_{|dst|=1} |m*dst|
static void solveZ ( const Mat & src , CV_OUT Mat & dst ) ;
static void solveZ ( const InputArray & src , OutputArray dst ) ;
//! performs back substitution, so that dst is the solution or pseudo-solution of m*dst = rhs, where m is the decomposed matrix
//! performs back substitution, so that dst is the solution or pseudo-solution of m*dst = rhs, where m is the decomposed matrix
void backSubst ( const Mat & rhs , CV_OUT Mat & dst ) const ;
void backSubst ( const InputArray & rhs , OutputArray dst ) const ;
Mat u , w , vt ;
Mat u , w , vt ;
} ;
} ;
//! computes Mahalanobis distance between two vectors: sqrt((v1-v2)'*icovar*(v1-v2)), where icovar is the inverse covariation matrix
//! computes Mahalanobis distance between two vectors: sqrt((v1-v2)'*icovar*(v1-v2)), where icovar is the inverse covariation matrix
CV_EXPORTS_W double Mahalanobis ( const Mat & v1 , const Mat & v2 , const Mat & icovar ) ;
CV_EXPORTS_W double Mahalanobis ( const InputArray & v1 , const InputArray & v2 , const InputArray & icovar ) ;
//! a synonym for Mahalanobis
//! a synonym for Mahalanobis
CV_EXPORTS double Mahalonobis ( const Mat & v1 , const Mat & v2 , const Mat & icovar ) ;
CV_EXPORTS double Mahalonobis ( const InputArray & v1 , const InputArray & v2 , const InputArray & icovar ) ;
//! performs forward or inverse 1D or 2D Discrete Fourier Transformation
//! performs forward or inverse 1D or 2D Discrete Fourier Transformation
CV_EXPORTS_W void dft ( const Mat & src , CV_OUT Mat & dst , int flags = 0 , int nonzeroRows = 0 ) ;
CV_EXPORTS_W void dft ( const InputArray & src , OutputArray dst , int flags = 0 , int nonzeroRows = 0 ) ;
//! performs inverse 1D or 2D Discrete Fourier Transformation
//! performs inverse 1D or 2D Discrete Fourier Transformation
CV_EXPORTS_W void idft ( const Mat & src , CV_OUT Mat & dst , int flags = 0 , int nonzeroRows = 0 ) ;
CV_EXPORTS_W void idft ( const InputArray & src , OutputArray dst , int flags = 0 , int nonzeroRows = 0 ) ;
//! performs forward or inverse 1D or 2D Discrete Cosine Transformation
//! performs forward or inverse 1D or 2D Discrete Cosine Transformation
CV_EXPORTS_W void dct ( const Mat & src , CV_OUT Mat & dst , int flags = 0 ) ;
CV_EXPORTS_W void dct ( const InputArray & src , OutputArray dst , int flags = 0 ) ;
//! performs inverse 1D or 2D Discrete Cosine Transformation
//! performs inverse 1D or 2D Discrete Cosine Transformation
CV_EXPORTS_W void idct ( const Mat & src , CV_OUT Mat & dst , int flags = 0 ) ;
CV_EXPORTS_W void idct ( const InputArray & src , OutputArray dst , int flags = 0 ) ;
//! computes element-wise product of the two Fourier spectrums. The second spectrum can optionally be conjugated before the multiplication
//! computes element-wise product of the two Fourier spectrums. The second spectrum can optionally be conjugated before the multiplication
CV_EXPORTS_W void mulSpectrums ( const Mat & a , const Mat & b , CV_OUT Mat & c ,
CV_EXPORTS_W void mulSpectrums ( const InputArray & a , const InputArray & b , OutputArray c ,
int flags , bool conjB = false ) ;
int flags , bool conjB = false ) ;
//! computes the minimal vector size vecsize1 >= vecsize so that the dft() of the vector of length vecsize1 can be computed efficiently
//! computes the minimal vector size vecsize1 >= vecsize so that the dft() of the vector of length vecsize1 can be computed efficiently
CV_EXPORTS_W int getOptimalDFTSize ( int vecsize ) ;
CV_EXPORTS_W int getOptimalDFTSize ( int vecsize ) ;
@ -2250,9 +2326,9 @@ enum
KMEANS_USE_INITIAL_LABELS = 1 // Uses the user-provided labels for K-Means initialization
KMEANS_USE_INITIAL_LABELS = 1 // Uses the user-provided labels for K-Means initialization
} ;
} ;
//! clusters the input data using k-Means algorithm
//! clusters the input data using k-Means algorithm
CV_EXPORTS_W double kmeans ( const Mat & data , int K , CV_OUT Mat & bestLabels ,
CV_EXPORTS_W double kmeans ( const InputArray & data , int K , CV_OUT InputOutputArray bestLabels ,
TermCriteria criteria , int attempts ,
TermCriteria criteria , int attempts ,
int flags , CV_OUT Mat * centers = 0 ) ;
int flags , OutputArray centers = OutputArray ( ) ) ;
//! returns the thread-local Random number generator
//! returns the thread-local Random number generator
CV_EXPORTS RNG & theRNG ( ) ;
CV_EXPORTS RNG & theRNG ( ) ;
@ -2261,13 +2337,13 @@ CV_EXPORTS RNG& theRNG();
template < typename _Tp > static inline _Tp randu ( ) { return ( _Tp ) theRNG ( ) ; }
template < typename _Tp > static inline _Tp randu ( ) { return ( _Tp ) theRNG ( ) ; }
//! fills array with uniformly-distributed random numbers from the range [low, high)
//! fills array with uniformly-distributed random numbers from the range [low, high)
CV_EXPORTS_W void randu ( CV_OUT Mat & dst , const Scalar & low , const Scalar & high ) ;
CV_EXPORTS_W void randu ( CV_IN_OUT OutputArray dst , const InputArray & low , const InputArray & high ) ;
//! fills array with normally-distributed random numbers with the specified mean and the standard deviation
//! fills array with normally-distributed random numbers with the specified mean and the standard deviation
CV_EXPORTS_W void randn ( CV_OUT Mat & dst , const Scalar & mean , const Scalar & stddev ) ;
CV_EXPORTS_W void randn ( CV_IN_OUT OutputArray dst , const InputArray & mean , const InputArray & stddev ) ;
//! shuffles the input array elements
//! shuffles the input array elements
CV_EXPORTS void randShuffle ( Mat & dst , double iterFactor = 1. , RNG * rng = 0 ) ;
CV_EXPORTS void randShuffle ( InputOutputArray dst , double iterFactor = 1. , RNG * rng = 0 ) ;
//! draws the line segment (pt1, pt2) in the image
//! draws the line segment (pt1, pt2) in the image
CV_EXPORTS_W void line ( Mat & img , Point pt1 , Point pt2 , const Scalar & color ,
CV_EXPORTS_W void line ( Mat & img , Point pt1 , Point pt2 , const Scalar & color ,
@ -2828,6 +2904,7 @@ template<typename _Tp, size_t fixed_size=4096/sizeof(_Tp)+8> class CV_EXPORTS Au
{
{
public :
public :
typedef _Tp value_type ;
typedef _Tp value_type ;
enum { buffer_padding = ( int ) ( ( 16 + sizeof ( _Tp ) - 1 ) / sizeof ( _Tp ) ) } ;
//! the default contructor
//! the default contructor
AutoBuffer ( ) ;
AutoBuffer ( ) ;
@ -2851,7 +2928,7 @@ protected:
//! size of the real buffer
//! size of the real buffer
size_t size ;
size_t size ;
//! pre-allocated buffer
//! pre-allocated buffer
_Tp buf [ fixed_size ] ;
_Tp buf [ fixed_size + buffer_padding ] ;
} ;
} ;
/////////////////////////// multi-dimensional dense matrix //////////////////////////
/////////////////////////// multi-dimensional dense matrix //////////////////////////
@ -2912,9 +2989,11 @@ public:
//! the default constructor
//! the default constructor
NAryMatIterator ( ) ;
NAryMatIterator ( ) ;
//! the full constructor taking arbitrary number of n-dim matrices
//! the full constructor taking arbitrary number of n-dim matrices
NAryMatIterator ( const Mat * * arrays , uchar * * ptrs , int narrays = - 1 ) ;
//! the full constructor taking arbitrary number of n-dim matrices
NAryMatIterator ( const Mat * * arrays , Mat * planes , int narrays = - 1 ) ;
NAryMatIterator ( const Mat * * arrays , Mat * planes , int narrays = - 1 ) ;
//! the separate iterator initialization method
//! the separate iterator initialization method
void init ( const Mat * * arrays , Mat * planes , int narrays = - 1 ) ;
void init ( const Mat * * arrays , Mat * planes , uchar * * ptrs , int narrays = - 1 ) ;
//! proceeds to the next plane of every iterated matrix
//! proceeds to the next plane of every iterated matrix
NAryMatIterator & operator + + ( ) ;
NAryMatIterator & operator + + ( ) ;
@ -2925,12 +3004,17 @@ public:
const Mat * * arrays ;
const Mat * * arrays ;
//! the current planes
//! the current planes
Mat * planes ;
Mat * planes ;
//! data pointers
uchar * * ptrs ;
//! the number of arrays
//! the number of arrays
int narrays ;
int narrays ;
//! the number of planes in each array
//! the number of hyper-planes that the iterator steps through
int nplanes ;
size_t nplanes ;
//! the size of each segment (in elements)
size_t size ;
protected :
protected :
int iterdepth , idx ;
int iterdepth ;
size_t idx ;
} ;
} ;
//typedef NAryMatIterator NAryMatNDIterator;
//typedef NAryMatIterator NAryMatNDIterator;
@ -3081,7 +3165,7 @@ public:
\ param try1d if true and m is a single - column matrix ( Nx1 ) ,
\ param try1d if true and m is a single - column matrix ( Nx1 ) ,
then the sparse matrix will be 1 - dimensional .
then the sparse matrix will be 1 - dimensional .
*/
*/
SparseMat ( const Mat & m ) ;
explicit SparseMat ( const Mat & m ) ;
//! converts old-style sparse matrix to the new-style. All the data is copied
//! converts old-style sparse matrix to the new-style. All the data is copied
SparseMat ( const CvSparseMat * m ) ;
SparseMat ( const CvSparseMat * m ) ;
//! the destructor
//! the destructor
@ -3563,39 +3647,30 @@ public:
//! the default constructor
//! the default constructor
CV_WRAP KDTree ( ) ;
CV_WRAP KDTree ( ) ;
//! the full constructor that builds the search tree
//! the full constructor that builds the search tree
CV_WRAP KDTree ( const Mat & _ points, bool copyAndReorderPoints = false ) ;
CV_WRAP KDTree ( const InputArray & points , bool copyAndReorderPoints = false ) ;
//! the full constructor that builds the search tree
//! the full constructor that builds the search tree
CV_WRAP KDTree ( const Mat & _points , const Mat & _labels , bool copyAndReorderPoints = false ) ;
CV_WRAP KDTree ( const InputArray & points , const InputArray & _labels ,
bool copyAndReorderPoints = false ) ;
//! builds the search tree
//! builds the search tree
CV_WRAP void build ( const Mat & _ points, bool copyAndReorderPoints = false ) ;
CV_WRAP void build ( const InputArray & points , bool copyAndReorderPoints = false ) ;
//! builds the search tree
//! builds the search tree
CV_WRAP void build ( const Mat & _points , const Mat & _labels , bool copyAndReorderPoints = false ) ;
CV_WRAP void build ( const InputArray & points , const InputArray & labels ,
bool copyAndReorderPoints = false ) ;
//! finds the K nearest neighbors of "vec" while looking at Emax (at most) leaves
//! finds the K nearest neighbors of "vec" while looking at Emax (at most) leaves
int findNearest ( const float * vec ,
CV_WRAP int findNearest ( const InputArray & vec , int K , int Emax ,
int K , int Emax , int * neighborsIdx ,
OutputArray neighborsIdx ,
Mat * neighbors = 0 , float * dist = 0 , int * labels = 0 ) const ;
OutputArray neighbors = OutputArray ( ) ,
//! finds the K nearest neighbors while looking at Emax (at most) leaves
OutputArray dist = OutputArray ( ) ,
int findNearest ( const float * vec , int K , int Emax ,
OutputArray labels = OutputArray ( ) ) const ;
vector < int > * neighborsIdx ,
Mat * neighbors = 0 ,
vector < float > * dist = 0 ,
vector < int > * labels = 0 ) const ;
CV_WRAP int findNearest ( const vector < float > & vec , int K , int Emax ,
CV_OUT vector < int > * neighborsIdx ,
CV_OUT Mat * neighbors = 0 ,
CV_OUT vector < float > * dist = 0 ,
CV_OUT vector < int > * labels = 0 ) const ;
//! finds all the points from the initial set that belong to the specified box
//! finds all the points from the initial set that belong to the specified box
void findOrthoRange ( const float * minBounds , const float * maxBounds ,
CV_WRAP void findOrthoRange ( const InputArray & minBounds ,
vector < int > * neighborsIdx , Mat * neighbors = 0 ,
const InputArray & maxBounds ,
vector < int > * labels = 0 ) const ;
OutputArray neighborsIdx ,
CV_WRAP void findOrthoRange ( const vector < float > & minBounds , const vector < float > & maxBounds ,
OutputArray neighbors = OutputArray ( ) ,
CV_OUT vector < int > * neighborsIdx , CV_OUT Mat * neighbors = 0 ,
OutputArray labels = OutputArray ( ) ) const ;
CV_OUT vector < int > * labels = 0 ) const ;
//! returns vectors with the specified indices
//! returns vectors with the specified indices
void getPoints ( const int * idx , size_t nidx , Mat & pts , vector < int > * labels = 0 ) const ;
CV_WRAP void getPoints ( const InputArray & idx , OutputArray pts ,
//! returns vectors with the specified indices
OutputArray labels = OutputArray ( ) ) const ;
CV_WRAP void getPoints ( const vector < int > & idxs , Mat & pts , CV_OUT vector < int > * labels = 0 ) const ;
//! return a vector with the specified index
//! return a vector with the specified index
const float * getPoint ( int ptidx , int * label = 0 ) const ;
const float * getPoint ( int ptidx , int * label = 0 ) const ;
//! returns the search space dimensionality
//! returns the search space dimensionality
@ -4042,7 +4117,7 @@ public:
int index ;
int index ;
} ;
} ;
#if 0
class CV_EXPORTS AlgorithmImpl ;
class CV_EXPORTS AlgorithmImpl ;
/*!
/*!
@ -4088,7 +4163,6 @@ protected:
Ptr < AlgorithmImpl > impl ;
Ptr < AlgorithmImpl > impl ;
} ;
} ;
# endif
}
}