Merge pull request #791 from taka-no-me:cleanup_core_api

This commit is contained in:
Andrey Kamaev 2013-04-11 11:34:04 +04:00 committed by OpenCV Buildbot
commit ebb1f12aa7
14 changed files with 85 additions and 162 deletions

View File

@ -1081,11 +1081,9 @@ eigen
----- -----
Calculates eigenvalues and eigenvectors of a symmetric matrix. Calculates eigenvalues and eigenvectors of a symmetric matrix.
.. ocv:function:: bool eigen(InputArray src, OutputArray eigenvalues, int lowindex=-1, int highindex=-1) .. ocv:function:: bool eigen( InputArray src, OutputArray eigenvalues, OutputArray eigenvectors=noArray() )
.. ocv:function:: bool eigen(InputArray src, OutputArray eigenvalues, OutputArray eigenvectors, int lowindex=-1,int highindex=-1) .. ocv:pyfunction:: cv2.eigen(src[, eigenvalues[, eigenvectors]]) -> retval, eigenvalues, eigenvectors
.. ocv:pyfunction:: cv2.eigen(src, computeEigenvectors[, eigenvalues[, eigenvectors]]) -> retval, eigenvalues, eigenvectors
.. ocv:cfunction:: void cvEigenVV( CvArr* mat, CvArr* evects, CvArr* evals, double eps=0, int lowindex=-1, int highindex=-1 ) .. ocv:cfunction:: void cvEigenVV( CvArr* mat, CvArr* evects, CvArr* evals, double eps=0, int lowindex=-1, int highindex=-1 )
@ -1284,40 +1282,6 @@ The function can be replaced with a matrix expression. For example, the above ca
getConvertElem
--------------
Returns a conversion function for a single pixel.
.. ocv:function:: ConvertData getConvertElem(int fromType, int toType)
.. ocv:function:: ConvertScaleData getConvertScaleElem(int fromType, int toType)
:param fromType: input pixel type.
:param toType: output pixel type.
:param from: callback parameter: pointer to the input pixel.
:param to: callback parameter: pointer to the output pixel
:param cn: callback parameter: the number of channels; it can be arbitrary, 1, 100, 100000, etc.
:param alpha: ``ConvertScaleData`` callback optional parameter: the scale factor.
:param beta: ``ConvertScaleData`` callback optional parameter: the delta or offset.
The functions ``getConvertElem`` and ``getConvertScaleElem`` return pointers to the functions for converting individual pixels from one type to another. While the main function purpose is to convert single pixels (actually, for converting sparse matrices from one type to another), you can use them to convert the whole row of a dense matrix or the whole matrix at once, by setting ``cn = matrix.cols*matrix.rows*matrix.channels()`` if the matrix data is continuous.
``ConvertData`` and ``ConvertScaleData`` are defined as: ::
typedef void (*ConvertData)(const void* from, void* to, int cn)
typedef void (*ConvertScaleData)(const void* from, void* to,
int cn, double alpha, double beta)
.. seealso:: :ocv:func:`Mat::convertTo` , :ocv:func:`SparseMat::convertTo`
getOptimalDFTSize getOptimalDFTSize
----------------- -----------------
Returns the optimal DFT size for a given vector size. Returns the optimal DFT size for a given vector size.
@ -1523,9 +1487,9 @@ LUT
--- ---
Performs a look-up table transform of an array. Performs a look-up table transform of an array.
.. ocv:function:: void LUT( InputArray src, InputArray lut, OutputArray dst, int interpolation=0 ) .. ocv:function:: void LUT( InputArray src, InputArray lut, OutputArray dst )
.. ocv:pyfunction:: cv2.LUT(src, lut[, dst[, interpolation]]) -> dst .. ocv:pyfunction:: cv2.LUT(src, lut[, dst]) -> dst
.. ocv:cfunction:: void cvLUT(const CvArr* src, CvArr* dst, const CvArr* lut) .. ocv:cfunction:: void cvLUT(const CvArr* src, CvArr* dst, const CvArr* lut)
.. ocv:pyoldfunction:: cv.LUT(src, dst, lut)-> None .. ocv:pyoldfunction:: cv.LUT(src, dst, lut)-> None
@ -1628,8 +1592,6 @@ Calculates per-element maximum of two arrays or an array and a scalar.
.. ocv:function:: void max(const Mat& src1, const Mat& src2, Mat& dst) .. ocv:function:: void max(const Mat& src1, const Mat& src2, Mat& dst)
.. ocv:function:: void max( const Mat& src1, double src2, Mat& dst )
.. ocv:pyfunction:: cv2.max(src1, src2[, dst]) -> dst .. ocv:pyfunction:: cv2.max(src1, src2[, dst]) -> dst
.. ocv:cfunction:: void cvMax(const CvArr* src1, const CvArr* src2, CvArr* dst) .. ocv:cfunction:: void cvMax(const CvArr* src1, const CvArr* src2, CvArr* dst)
@ -1791,8 +1753,6 @@ Calculates per-element minimum of two arrays or an array and a scalar.
.. ocv:function:: void min(const Mat& src1, const Mat& src2, Mat& dst) .. ocv:function:: void min(const Mat& src1, const Mat& src2, Mat& dst)
.. ocv:function:: void min( const Mat& src1, double src2, Mat& dst )
.. ocv:pyfunction:: cv2.min(src1, src2[, dst]) -> dst .. ocv:pyfunction:: cv2.min(src1, src2[, dst]) -> dst
.. ocv:cfunction:: void cvMin(const CvArr* src1, const CvArr* src2, CvArr* dst) .. ocv:cfunction:: void cvMin(const CvArr* src1, const CvArr* src2, CvArr* dst)
@ -1920,9 +1880,11 @@ Copies specified channels from input arrays to the specified channels of output
.. ocv:function:: void mixChannels( const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts, const int* fromTo, size_t npairs ) .. ocv:function:: void mixChannels( const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts, const int* fromTo, size_t npairs )
.. ocv:function:: void mixChannels( const vector<Mat>& src, vector<Mat>& dst, const int* fromTo, size_t npairs ) .. ocv:function:: void mixChannels( InputArrayOfArrays src, InputOutputArrayOfArrays dst, const int* fromTo, size_t npairs )
.. ocv:pyfunction:: cv2.mixChannels(src, dst, fromTo) -> None .. ocv:function:: void mixChannels( InputArrayOfArrays src, InputOutputArrayOfArrays dst, const std::vector<int>& fromTo )
.. ocv:pyfunction:: cv2.mixChannels(src, dst, fromTo) -> dst
.. ocv:cfunction:: void cvMixChannels( const CvArr** src, int src_count, CvArr** dst, int dst_count, const int* from_to, int pair_count ) .. ocv:cfunction:: void cvMixChannels( const CvArr** src, int src_count, CvArr** dst, int dst_count, const int* from_to, int pair_count )

View File

@ -109,15 +109,6 @@ public:
CV_EXPORTS void error( const Exception& exc ); CV_EXPORTS void error( const Exception& exc );
typedef void (*BinaryFunc)(const uchar* src1, size_t step1,
const uchar* src2, size_t step2,
uchar* dst, size_t step, Size sz,
void*);
CV_EXPORTS BinaryFunc getConvertFunc(int sdepth, int ddepth);
CV_EXPORTS BinaryFunc getConvertScaleFunc(int sdepth, int ddepth);
CV_EXPORTS BinaryFunc getCopyMaskFunc(size_t esz);
//! swaps two matrices //! swaps two matrices
CV_EXPORTS void swap(Mat& a, Mat& b); CV_EXPORTS void swap(Mat& a, Mat& b);
@ -153,8 +144,7 @@ CV_EXPORTS_W void convertScaleAbs(InputArray src, OutputArray dst,
double alpha = 1, double beta = 0); double alpha = 1, double beta = 0);
//! transforms array of numbers using a lookup table: dst(i)=lut(src(i)) //! transforms array of numbers using a lookup table: dst(i)=lut(src(i))
CV_EXPORTS_W void LUT(InputArray src, InputArray lut, OutputArray dst, CV_EXPORTS_W void LUT(InputArray src, InputArray lut, OutputArray dst);
int interpolation = 0);
//! computes sum of array elements //! computes sum of array elements
CV_EXPORTS_AS(sumElems) Scalar sum(InputArray src); CV_EXPORTS_AS(sumElems) Scalar sum(InputArray src);
@ -227,11 +217,11 @@ CV_EXPORTS_W void split(InputArray m, OutputArrayOfArrays 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 std::vector<Mat>& src, std::vector<Mat>& dst, CV_EXPORTS void mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst,
const int* fromTo, size_t npairs); //TODO: use arrays const int* fromTo, size_t npairs);
CV_EXPORTS_W void mixChannels(InputArrayOfArrays src, InputArrayOfArrays dst, CV_EXPORTS_W void mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst,
const std::vector<int>& fromTo); //TODO: InputOutputArrayOfArrays const std::vector<int>& fromTo);
//! extracts a single channel from src (coi is 0-based index) //! extracts a single channel from src (coi is 0-based index)
CV_EXPORTS_W void extractChannel(InputArray src, OutputArray dst, int coi); CV_EXPORTS_W void extractChannel(InputArray src, OutputArray dst, int coi);
@ -291,15 +281,12 @@ CV_EXPORTS_W void min(InputArray src1, InputArray src2, OutputArray 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(InputArray src1, InputArray src2, OutputArray dst); CV_EXPORTS_W void max(InputArray src1, InputArray src2, OutputArray dst);
//TODO: can we drop these versions? // the following overloads are needed to avoid conflicts with
// const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
//! computes per-element minimum of two arrays (dst = min(src1, src2)) //! computes per-element minimum of two arrays (dst = min(src1, src2))
CV_EXPORTS void min(const Mat& src1, const Mat& src2, 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))
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 void max(const Mat& src1, const Mat& src2, 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))
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(InputArray src, OutputArray dst); CV_EXPORTS_W void sqrt(InputArray src, OutputArray dst);
@ -393,17 +380,9 @@ CV_EXPORTS_W int solveCubic(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(InputArray coeffs, OutputArray roots, int maxIters = 300); CV_EXPORTS_W double solvePoly(InputArray coeffs, OutputArray roots, int maxIters = 300);
//! finds eigenvalues of a symmetric matrix
CV_EXPORTS bool eigen(InputArray src, OutputArray eigenvalues, int lowindex = -1,
int highindex = -1);
//! finds eigenvalues and eigenvectors of a symmetric matrix //! finds eigenvalues and eigenvectors of a symmetric matrix
CV_EXPORTS bool eigen(InputArray src, OutputArray eigenvalues, CV_EXPORTS_W bool eigen(InputArray src, OutputArray eigenvalues,
OutputArray eigenvectors, OutputArray eigenvectors = noArray());
int lowindex = -1, int highindex = -1);
CV_EXPORTS_W bool eigen(InputArray src, bool computeEigenvectors,
OutputArray eigenvalues, OutputArray eigenvectors);
enum enum
{ {
@ -417,10 +396,10 @@ enum
//! 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); //TODO: output arrays or drop int flags, int ctype = CV_64F); //TODO: InputArrayOfArrays
//! computes covariation matrix of a set of samples //! computes covariation matrix of a set of samples
CV_EXPORTS_W void calcCovarMatrix( InputArray samples, OutputArray covar, //TODO: InputArrayOfArrays CV_EXPORTS_W void calcCovarMatrix( InputArray samples, OutputArray covar,
OutputArray mean, int flags, int ctype = CV_64F); OutputArray mean, int flags, int ctype = CV_64F);
CV_EXPORTS_W void PCACompute(InputArray data, InputOutputArray mean, CV_EXPORTS_W void PCACompute(InputArray data, InputOutputArray mean,
@ -445,9 +424,6 @@ CV_EXPORTS_W void SVBackSubst( InputArray w, InputArray u, InputArray 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(InputArray v1, InputArray v2, InputArray icovar); CV_EXPORTS_W double Mahalanobis(InputArray v1, InputArray v2, InputArray icovar);
//! a synonym for Mahalanobis
CV_EXPORTS double Mahalonobis(InputArray v1, InputArray v2, InputArray icovar); //TODO: check if we can drop it or move to legacy
//! 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(InputArray src, OutputArray dst, int flags = 0, int nonzeroRows = 0); CV_EXPORTS_W void dft(InputArray src, OutputArray dst, int flags = 0, int nonzeroRows = 0);
@ -492,9 +468,7 @@ CV_EXPORTS_W void randu(InputOutputArray dst, InputArray low, InputArray high);
CV_EXPORTS_W void randn(InputOutputArray dst, InputArray mean, InputArray stddev); CV_EXPORTS_W void randn(InputOutputArray dst, InputArray mean, InputArray stddev);
//! shuffles the input array elements //! shuffles the input array elements
CV_EXPORTS void randShuffle(InputOutputArray dst, double iterFactor = 1., RNG* rng = 0); CV_EXPORTS_W void randShuffle(InputOutputArray dst, double iterFactor = 1., RNG* rng = 0);
CV_EXPORTS_AS(randShuffle) void randShuffle_(InputOutputArray dst, double iterFactor = 1.);
enum { FILLED = -1, enum { FILLED = -1,
LINE_4 = 4, LINE_4 = 4,
@ -601,17 +575,6 @@ CV_EXPORTS_W Size getTextSize(const String& text, int fontFace,
double fontScale, int thickness, double fontScale, int thickness,
CV_OUT int* baseLine); CV_OUT int* baseLine);
typedef void (*ConvertData)(const void* from, void* to, int cn);
typedef void (*ConvertScaleData)(const void* from, void* to, int cn, double alpha, double beta);
//! returns the function for converting pixels from one data type to another
CV_EXPORTS ConvertData getConvertElem(int fromType, int toType);
//! returns the function for converting pixels from one data type to another with the optional scaling
CV_EXPORTS ConvertScaleData getConvertScaleElem(int fromType, int toType);
/*! /*!
Principal Component Analysis Principal Component Analysis

View File

@ -1197,17 +1197,6 @@ void cv::min(const Mat& src1, const Mat& src2, Mat& dst)
binary_op(src1, src2, _dst, noArray(), minTab, false ); binary_op(src1, src2, _dst, noArray(), minTab, false );
} }
void cv::max(const Mat& src1, double src2, Mat& dst)
{
OutputArray _dst(dst);
binary_op(src1, src2, _dst, noArray(), maxTab, false );
}
void cv::min(const Mat& src1, double src2, Mat& dst)
{
OutputArray _dst(dst);
binary_op(src1, src2, _dst, noArray(), minTab, false );
}
/****************************************************************************************\ /****************************************************************************************\
* add/subtract * * add/subtract *

View File

@ -505,14 +505,30 @@ void cv::mixChannels( const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts, cons
} }
void cv::mixChannels(const std::vector<Mat>& src, std::vector<Mat>& dst, void cv::mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst,
const int* fromTo, size_t npairs) const int* fromTo, size_t npairs)
{ {
mixChannels(!src.empty() ? &src[0] : 0, src.size(), if(npairs == 0)
!dst.empty() ? &dst[0] : 0, dst.size(), fromTo, npairs); return;
bool src_is_mat = src.kind() != _InputArray::STD_VECTOR_MAT &&
src.kind() != _InputArray::STD_VECTOR_VECTOR;
bool dst_is_mat = dst.kind() != _InputArray::STD_VECTOR_MAT &&
dst.kind() != _InputArray::STD_VECTOR_VECTOR;
int i;
int nsrc = src_is_mat ? 1 : (int)src.total();
int ndst = dst_is_mat ? 1 : (int)dst.total();
CV_Assert(nsrc > 0 && ndst > 0);
cv::AutoBuffer<Mat> _buf(nsrc + ndst);
Mat* buf = _buf;
for( i = 0; i < nsrc; i++ )
buf[i] = src.getMat(src_is_mat ? -1 : i);
for( i = 0; i < ndst; i++ )
buf[nsrc + i] = dst.getMat(dst_is_mat ? -1 : i);
mixChannels(&buf[0], nsrc, &buf[nsrc], ndst, fromTo, npairs);
} }
void cv::mixChannels(InputArrayOfArrays src, InputArrayOfArrays dst, void cv::mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst,
const std::vector<int>& fromTo) const std::vector<int>& fromTo)
{ {
if(fromTo.empty()) if(fromTo.empty())
@ -1027,7 +1043,7 @@ BinaryFunc getConvertFunc(int sdepth, int ddepth)
return cvtTab[CV_MAT_DEPTH(ddepth)][CV_MAT_DEPTH(sdepth)]; return cvtTab[CV_MAT_DEPTH(ddepth)][CV_MAT_DEPTH(sdepth)];
} }
BinaryFunc getConvertScaleFunc(int sdepth, int ddepth) static BinaryFunc getConvertScaleFunc(int sdepth, int ddepth)
{ {
return cvtScaleTab[CV_MAT_DEPTH(ddepth)][CV_MAT_DEPTH(sdepth)]; return cvtScaleTab[CV_MAT_DEPTH(ddepth)][CV_MAT_DEPTH(sdepth)];
} }
@ -1173,10 +1189,9 @@ static LUTFunc lutTab[] =
} }
void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst, int interpolation ) void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst )
{ {
Mat src = _src.getMat(), lut = _lut.getMat(); Mat src = _src.getMat(), lut = _lut.getMat();
CV_Assert( interpolation == 0 );
int cn = src.channels(); int cn = src.channels();
int lutcn = lut.channels(); int lutcn = lut.channels();

View File

@ -1464,7 +1464,7 @@ bool cv::solve( InputArray _src, InputArray _src2arg, OutputArray _dst, int meth
/////////////////// finding eigenvalues and eigenvectors of a symmetric matrix /////////////// /////////////////// finding eigenvalues and eigenvectors of a symmetric matrix ///////////////
bool cv::eigen( InputArray _src, bool computeEvects, OutputArray _evals, OutputArray _evects ) bool cv::eigen( InputArray _src, OutputArray _evals, OutputArray _evects )
{ {
Mat src = _src.getMat(); Mat src = _src.getMat();
int type = src.type(); int type = src.type();
@ -1474,7 +1474,7 @@ bool cv::eigen( InputArray _src, bool computeEvects, OutputArray _evals, OutputA
CV_Assert (type == CV_32F || type == CV_64F); CV_Assert (type == CV_32F || type == CV_64F);
Mat v; Mat v;
if( computeEvects ) if( _evects.needed() )
{ {
_evects.create(n, n, type); _evects.create(n, n, type);
v = _evects.getMat(); v = _evects.getMat();
@ -1494,16 +1494,6 @@ bool cv::eigen( InputArray _src, bool computeEvects, OutputArray _evals, OutputA
return ok; return ok;
} }
bool cv::eigen( InputArray src, OutputArray evals, int, int )
{
return eigen(src, false, evals, noArray());
}
bool cv::eigen( InputArray src, OutputArray evals, OutputArray evects, int, int)
{
return eigen(src, true, evals, evects);
}
namespace cv namespace cv
{ {
@ -1705,13 +1695,13 @@ cvSolve( const CvArr* Aarr, const CvArr* barr, CvArr* xarr, int method )
CV_IMPL void CV_IMPL void
cvEigenVV( CvArr* srcarr, CvArr* evectsarr, CvArr* evalsarr, double, cvEigenVV( CvArr* srcarr, CvArr* evectsarr, CvArr* evalsarr, double,
int lowindex, int highindex) int, int )
{ {
cv::Mat src = cv::cvarrToMat(srcarr), evals0 = cv::cvarrToMat(evalsarr), evals = evals0; cv::Mat src = cv::cvarrToMat(srcarr), evals0 = cv::cvarrToMat(evalsarr), evals = evals0;
if( evectsarr ) if( evectsarr )
{ {
cv::Mat evects0 = cv::cvarrToMat(evectsarr), evects = evects0; cv::Mat evects0 = cv::cvarrToMat(evectsarr), evects = evects0;
eigen(src, evals, evects, lowindex, highindex); eigen(src, evals, evects);
if( evects0.data != evects.data ) if( evects0.data != evects.data )
{ {
uchar* p = evects0.data; uchar* p = evects0.data;
@ -1720,7 +1710,7 @@ cvEigenVV( CvArr* srcarr, CvArr* evectsarr, CvArr* evalsarr, double,
} }
} }
else else
eigen(src, evals, lowindex, highindex); eigen(src, evals);
if( evals0.data != evals.data ) if( evals0.data != evals.data )
{ {
uchar* p = evals0.data; uchar* p = evals0.data;

View File

@ -2308,11 +2308,6 @@ double cv::Mahalanobis( InputArray _v1, InputArray _v2, InputArray _icovar )
return std::sqrt(result); return std::sqrt(result);
} }
double cv::Mahalonobis( InputArray _v1, InputArray _v2, InputArray _icovar )
{
return Mahalanobis(_v1, _v2, _icovar);
}
/****************************************************************************************\ /****************************************************************************************\
* MulTransposed * * MulTransposed *
\****************************************************************************************/ \****************************************************************************************/

View File

@ -3448,7 +3448,10 @@ convertScaleData_(const void* _from, void* _to, int cn, double alpha, double bet
to[i] = saturate_cast<T2>(from[i]*alpha + beta); to[i] = saturate_cast<T2>(from[i]*alpha + beta);
} }
ConvertData getConvertElem(int fromType, int toType) typedef void (*ConvertData)(const void* from, void* to, int cn);
typedef void (*ConvertScaleData)(const void* from, void* to, int cn, double alpha, double beta);
static ConvertData getConvertElem(int fromType, int toType)
{ {
static ConvertData tab[][8] = static ConvertData tab[][8] =
{{ convertData_<uchar, uchar>, convertData_<uchar, schar>, {{ convertData_<uchar, uchar>, convertData_<uchar, schar>,
@ -3493,7 +3496,7 @@ ConvertData getConvertElem(int fromType, int toType)
return func; return func;
} }
ConvertScaleData getConvertScaleElem(int fromType, int toType) static ConvertScaleData getConvertScaleElem(int fromType, int toType)
{ {
static ConvertScaleData tab[][8] = static ConvertScaleData tab[][8] =
{{ convertScaleData_<uchar, uchar>, convertScaleData_<uchar, schar>, {{ convertScaleData_<uchar, uchar>, convertScaleData_<uchar, schar>,

View File

@ -69,6 +69,14 @@
namespace cv namespace cv
{ {
typedef void (*BinaryFunc)(const uchar* src1, size_t step1,
const uchar* src2, size_t step2,
uchar* dst, size_t step, Size sz,
void*);
BinaryFunc getConvertFunc(int sdepth, int ddepth);
BinaryFunc getCopyMaskFunc(size_t esz);
/* default memory block for sparse array elements */ /* default memory block for sparse array elements */
#define CV_SPARSE_MAT_BLOCK (1<<12) #define CV_SPARSE_MAT_BLOCK (1<<12)

View File

@ -861,11 +861,6 @@ void cv::randShuffle( InputOutputArray _dst, double iterFactor, RNG* _rng )
func( dst, rng, iterFactor ); func( dst, rng, iterFactor );
} }
void cv::randShuffle_( InputOutputArray _dst, double iterFactor )
{
randShuffle(_dst, iterFactor);
}
CV_IMPL void CV_IMPL void
cvRandArr( CvRNG* _rng, CvArr* arr, int disttype, CvScalar param1, CvScalar param2 ) cvRandArr( CvRNG* _rng, CvArr* arr, int disttype, CvScalar param1, CvScalar param2 )
{ {

View File

@ -294,7 +294,7 @@ bool Core_EigenTest::test_pairs(const cv::Mat& src)
cv::Mat eigen_values, eigen_vectors; cv::Mat eigen_values, eigen_vectors;
cv::eigen(src, true, eigen_values, eigen_vectors); cv::eigen(src, eigen_values, eigen_vectors);
if (!check_pair_count(src, eigen_values, eigen_vectors)) return false; if (!check_pair_count(src, eigen_values, eigen_vectors)) return false;
@ -362,8 +362,8 @@ bool Core_EigenTest::test_values(const cv::Mat& src)
if (!test_pairs(src)) return false; if (!test_pairs(src)) return false;
cv::eigen(src, true, eigen_values_1, eigen_vectors); cv::eigen(src, eigen_values_1, eigen_vectors);
cv::eigen(src, false, eigen_values_2, eigen_vectors); cv::eigen(src, eigen_values_2);
if (!check_pair_count(src, eigen_values_2)) return false; if (!check_pair_count(src, eigen_values_2)) return false;

View File

@ -460,7 +460,7 @@ public class CoreTest extends OpenCVTestCase {
Mat eigenVals = new Mat(); Mat eigenVals = new Mat();
Mat eigenVecs = new Mat(); Mat eigenVecs = new Mat();
Core.eigen(src, true, eigenVals, eigenVecs); Core.eigen(src, eigenVals, eigenVecs);
Mat expectedEigenVals = new Mat(3, 1, CvType.CV_32FC1) { Mat expectedEigenVals = new Mat(3, 1, CvType.CV_32FC1) {
{ {
@ -1113,18 +1113,6 @@ public class CoreTest extends OpenCVTestCase {
assertMatEqual(gray255, dst); assertMatEqual(gray255, dst);
} }
public void testLUTMatMatMatInt() {
Mat lut = new Mat(1, 256, CvType.CV_8UC1);
// TODO: ban this overload
try
{
Core.LUT(grayRnd, lut, dst, 1);
fail("Last parameter for LUT was not supported");
} catch (CvException e) {
// expected
}
}
public void testMagnitude() { public void testMagnitude() {
Mat x = new Mat(1, 4, CvType.CV_32F); Mat x = new Mat(1, 4, CvType.CV_32F);
Mat y = new Mat(1, 4, CvType.CV_32F); Mat y = new Mat(1, 4, CvType.CV_32F);

View File

@ -996,6 +996,11 @@ extern "C" {
return return
for a in fi.args: for a in fi.args:
if a.ctype not in type_dict: if a.ctype not in type_dict:
if not a.defval and a.ctype.endswith("*"):
a.defval = 0
if a.defval:
a.ctype = ''
continue
msg = "// Unknown type '%s' (%s), skipping the function\n\n" % (a.ctype, a.out or "I") msg = "// Unknown type '%s' (%s), skipping the function\n\n" % (a.ctype, a.out or "I")
self.skipped_func_list.append(c_decl + "\n" + msg) self.skipped_func_list.append(c_decl + "\n" + msg)
j_code.write( " "*4 + msg ) j_code.write( " "*4 + msg )

View File

@ -3,6 +3,8 @@
import hdr_parser, sys, re, os, cStringIO import hdr_parser, sys, re, os, cStringIO
from string import Template from string import Template
ignored_arg_types = ["RNG*"]
gen_template_check_self = Template(""" if(!PyObject_TypeCheck(self, &pyopencv_${name}_Type)) gen_template_check_self = Template(""" if(!PyObject_TypeCheck(self, &pyopencv_${name}_Type))
return failmsgp("Incorrect type of self (must be '${name}' or its derivative)"); return failmsgp("Incorrect type of self (must be '${name}' or its derivative)");
$cname* _self_ = ${amp}((pyopencv_${name}_t*)self)->v; $cname* _self_ = ${amp}((pyopencv_${name}_t*)self)->v;
@ -426,6 +428,8 @@ class FuncVariant(object):
argno += 1 argno += 1
if a.name in self.array_counters: if a.name in self.array_counters:
continue continue
if a.tp in ignored_arg_types:
continue
if a.returnarg: if a.returnarg:
outlist.append((a.name, argno)) outlist.append((a.name, argno))
if (not a.inputarg) and a.isbig(): if (not a.inputarg) and a.isbig():
@ -586,6 +590,16 @@ class FuncInfo(object):
# form the function/method call, # form the function/method call,
# for the list of type mappings # for the list of type mappings
for a in v.args: for a in v.args:
if a.tp in ignored_arg_types:
defval = a.defval
if not defval and a.tp.endswith("*"):
defval = 0
assert defval
if not code_fcall.endswith("("):
code_fcall += ", "
code_fcall += defval
all_cargs.append([[None, ""], ""])
continue
tp1 = tp = a.tp tp1 = tp = a.tp
amp = "" amp = ""
defval0 = "" defval0 = ""

View File

@ -486,8 +486,6 @@ public:
tau = _tau; tau = _tau;
detectShadows = _detectShadows; detectShadows = _detectShadows;
shadowVal = _shadowVal; shadowVal = _shadowVal;
cvtfunc = src->depth() != CV_32F ? getConvertFunc(src->depth(), CV_32F) : 0;
} }
void operator()(const Range& range) const void operator()(const Range& range) const
@ -501,8 +499,8 @@ public:
for( int y = y0; y < y1; y++ ) for( int y = y0; y < y1; y++ )
{ {
const float* data = buf; const float* data = buf;
if( cvtfunc ) if( src->depth() != CV_32F )
cvtfunc( src->ptr(y), src->step, 0, 0, (uchar*)data, 0, Size(ncols*nchannels, 1), 0); src->row(y).convertTo(Mat(1, ncols, CV_32FC(nchannels), (void*)data), CV_32F);
else else
data = src->ptr<float>(y); data = src->ptr<float>(y);
@ -685,8 +683,6 @@ public:
bool detectShadows; bool detectShadows;
uchar shadowVal; uchar shadowVal;
BinaryFunc cvtfunc;
}; };
void BackgroundSubtractorMOG2Impl::apply(InputArray _image, OutputArray _fgmask, double learningRate) void BackgroundSubtractorMOG2Impl::apply(InputArray _image, OutputArray _fgmask, double learningRate)