added COVAR_ and SORT_ enums to core.hpp; fixed many, many VS2005, VS2010 and MinGW (GCC 4.5.2) warnings

This commit is contained in:
Vadim Pisarevsky
2011-07-19 12:27:07 +00:00
parent 6bb1c07fd4
commit ff5e97c8e4
48 changed files with 443 additions and 385 deletions

View File

@@ -2150,6 +2150,15 @@ CV_EXPORTS_W double invert(InputArray src, OutputArray dst, int flags=DECOMP_LU)
//! solves linear system or a least-square problem
CV_EXPORTS_W bool solve(InputArray src1, InputArray src2,
OutputArray dst, int flags=DECOMP_LU);
enum
{
SORT_EVERY_ROW=0,
SORT_EVERY_COLUMN=1,
SORT_ASCENDING=0,
SORT_DESCENDING=16
};
//! sorts independently each matrix row or each matrix column
CV_EXPORTS_W void sort(InputArray src, OutputArray dst, int flags);
//! sorts independently each matrix row or each matrix column
@@ -2167,7 +2176,17 @@ CV_EXPORTS bool eigen(InputArray src, OutputArray eigenvalues,
int lowindex=-1, int highindex=-1);
CV_EXPORTS_W bool eigen(InputArray src, bool computeEigenvectors,
OutputArray eigenvalues, OutputArray eigenvectors);
enum
{
COVAR_SCRAMBLED=0,
COVAR_NORMAL=1,
COVAR_USE_AVG=2,
COVAR_SCALE=4,
COVAR_ROWS=8,
COVAR_COLS=16
};
//! computes covariation matrix of a set of samples
CV_EXPORTS void calcCovarMatrix( const Mat* samples, int nsamples, Mat& covar, Mat& mean,
int flags, int ctype=CV_64F);

View File

@@ -2780,7 +2780,8 @@ public:
size_t remaining = it->remaining, cn = DataType<_Tp>::channels;
int _fmt = DataType<_Tp>::fmt;
char fmt[] = { (char)((_fmt>>8)+'1'), (char)_fmt, '\0' };
count = std::min(count, remaining/cn);
size_t remaining1 = remaining/cn;
count = count < remaining1 ? count : remaining1;
vec.resize(count);
it->readRaw( string(fmt), (uchar*)&vec[0], count*sizeof(_Tp) );
}

View File

@@ -68,7 +68,9 @@ struct NOP {};
template<typename T, class Op, class Op8>
void vBinOp8(const T* src1, size_t step1, const T* src2, size_t step2, T* dst, size_t step, Size sz)
{
#if CV_SSE2
Op8 op8;
#endif
Op op;
for( ; sz.height--; src1 += step1/sizeof(src1[0]),
@@ -117,7 +119,9 @@ template<typename T, class Op, class Op16>
void vBinOp16(const T* src1, size_t step1, const T* src2, size_t step2,
T* dst, size_t step, Size sz)
{
#if CV_SSE2
Op16 op16;
#endif
Op op;
for( ; sz.height--; src1 += step1/sizeof(src1[0]),
@@ -168,7 +172,9 @@ template<class Op, class Op32>
void vBinOp32s(const int* src1, size_t step1, const int* src2, size_t step2,
int* dst, size_t step, Size sz)
{
#if CV_SSE2
Op32 op32;
#endif
Op op;
for( ; sz.height--; src1 += step1/sizeof(src1[0]),
@@ -223,7 +229,9 @@ template<class Op, class Op32>
void vBinOp32f(const float* src1, size_t step1, const float* src2, size_t step2,
float* dst, size_t step, Size sz)
{
#if CV_SSE2
Op32 op32;
#endif
Op op;
for( ; sz.height--; src1 += step1/sizeof(src1[0]),
@@ -276,7 +284,9 @@ template<class Op, class Op64>
void vBinOp64f(const double* src1, size_t step1, const double* src2, size_t step2,
double* dst, size_t step, Size sz)
{
#if CV_SSE2
Op64 op64;
#endif
Op op;
for( ; sz.height--; src1 += step1/sizeof(src1[0]),
@@ -1064,7 +1074,7 @@ void binary_op(InputArray _src1, InputArray _src2, OutputArray _dst,
{
for( size_t j = 0; j < total; j += blocksize )
{
int bsz = (int)std::min(total - j, blocksize);
int bsz = (int)MIN(total - j, blocksize);
func( ptrs[0], 0, ptrs[1], 0, haveMask ? maskbuf : ptrs[2], 0, Size(bsz*c, 1), 0 );
if( haveMask )
@@ -1096,7 +1106,7 @@ void binary_op(InputArray _src1, InputArray _src2, OutputArray _dst,
{
for( size_t j = 0; j < total; j += blocksize )
{
int bsz = (int)std::min(total - j, blocksize);
int bsz = (int)MIN(total - j, blocksize);
func( ptrs[0], 0, scbuf, 0, haveMask ? maskbuf : ptrs[1], 0, Size(bsz*c, 1), 0 );
if( haveMask )
@@ -1322,7 +1332,7 @@ void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
{
for( size_t j = 0; j < total; j += blocksize )
{
int bsz = (int)std::min(total - j, blocksize);
int bsz = (int)MIN(total - j, blocksize);
Size bszn(bsz*cn, 1);
const uchar *sptr1 = ptrs[0], *sptr2 = ptrs[1];
uchar* dptr = ptrs[2];
@@ -1387,7 +1397,7 @@ void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
{
for( size_t j = 0; j < total; j += blocksize )
{
int bsz = (int)std::min(total - j, blocksize);
int bsz = (int)MIN(total - j, blocksize);
Size bszn(bsz*cn, 1);
const uchar *sptr1 = ptrs[0];
const uchar* sptr2 = buf2;
@@ -2181,7 +2191,7 @@ void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op)
{
for( size_t j = 0; j < total; j += blocksize )
{
int bsz = (int)std::min(total - j, blocksize);
int bsz = (int)MIN(total - j, blocksize);
func( ptrs[0], 0, buf, 0, ptrs[1], 0, Size(bsz, 1), &op);
ptrs[0] += bsz*esz;
ptrs[1] += bsz;
@@ -2387,7 +2397,7 @@ void cv::inRange(InputArray _src, InputArray _lowerb,
{
for( size_t j = 0; j < total; j += blocksize )
{
int bsz = (int)std::min(total - j, blocksize);
int bsz = (int)MIN(total - j, blocksize);
size_t delta = bsz*esz;
uchar *lptr = lbuf, *uptr = ubuf;
if( !lbScalar )

View File

@@ -181,7 +181,7 @@ std::string CommandLineParser::getString(const std::string& keys) const
}
if (is_cur_found)
found_index=j;
found_index=(int)j;
}
if (found_index<0)

View File

@@ -220,7 +220,7 @@ void cv::split(const Mat& src, Mat* mv)
SplitFunc func = splitTab[depth];
CV_Assert( func != 0 );
int esz = src.elemSize(), esz1 = src.elemSize1();
int esz = (int)src.elemSize(), esz1 = (int)src.elemSize1();
int blocksize0 = (BLOCK_SIZE + esz-1)/esz;
AutoBuffer<uchar> _buf((cn+1)*(sizeof(Mat*) + sizeof(uchar*)) + 16);
const Mat** arrays = (const Mat**)(uchar*)_buf;
@@ -305,7 +305,7 @@ void cv::merge(const Mat* mv, size_t n, OutputArray _dst)
}
size_t esz = dst.elemSize(), esz1 = dst.elemSize1();
int blocksize0 = (BLOCK_SIZE + esz-1)/esz;
int blocksize0 = (int)((BLOCK_SIZE + esz-1)/esz);
AutoBuffer<uchar> _buf((cn+1)*(sizeof(Mat*) + sizeof(uchar*)) + 16);
const Mat** arrays = (const Mat**)(uchar*)_buf;
uchar** ptrs = (uchar**)alignPtr(arrays + cn + 1, 16);
@@ -451,12 +451,12 @@ void cv::mixChannels( const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts, cons
if( i0 < src[j].channels() )
break;
CV_Assert(j < nsrcs && src[j].depth() == depth);
tab[i*4] = j; tab[i*4+1] = i0*esz1;
tab[i*4] = (int)j; tab[i*4+1] = (int)(i0*esz1);
sdelta[i] = src[j].channels();
}
else
{
tab[i*4] = nsrcs + ndsts; tab[i*4+1] = 0;
tab[i*4] = (int)(nsrcs + ndsts); tab[i*4+1] = 0;
sdelta[i] = 0;
}
@@ -464,11 +464,11 @@ void cv::mixChannels( const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts, cons
if( i1 < dst[j].channels() )
break;
CV_Assert(i1 >= 0 && j < ndsts && dst[j].depth() == depth);
tab[i*4+2] = j + nsrcs; tab[i*4+3] = i1*esz1;
tab[i*4+2] = (int)(j + nsrcs); tab[i*4+3] = (int)(i1*esz1);
ddelta[i] = dst[j].channels();
}
NAryMatIterator it(arrays, ptrs, nsrcs + ndsts);
NAryMatIterator it(arrays, ptrs, (int)(nsrcs + ndsts));
int total = (int)it.size, blocksize = std::min(total, (int)((BLOCK_SIZE + esz1-1)/esz1));
MixChannelsFunc func = mixchTab[depth];
@@ -508,7 +508,7 @@ void cv::mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst,
{
if(fromTo.empty())
return;
size_t i, nsrc = src.total(), ndst = dst.total();
int i, nsrc = (int)src.total(), ndst = (int)dst.total();
CV_Assert(fromTo.size()%2 == 0 && nsrc > 0 && ndst > 0);
cv::AutoBuffer<Mat> _buf(nsrc + ndst);
Mat* buf = _buf;
@@ -516,7 +516,7 @@ void cv::mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst,
buf[i] = src.getMat(i);
for( i = 0; i < ndst; i++ )
buf[nsrc + i] = dst.getMat(i);
mixChannels(&buf[0], (int)nsrc, &buf[nsrc], (int)ndst, &fromTo[0], (int)(fromTo.size()/2));
mixChannels(&buf[0], nsrc, &buf[nsrc], ndst, &fromTo[0], fromTo.size()/2);
}
void cv::extractChannel(InputArray _src, OutputArray _dst, int coi)

View File

@@ -257,7 +257,7 @@ Mat& Mat::operator = (const Scalar& s)
for( size_t j = 0; j < size; j += blockSize )
{
size_t sz = std::min(blockSize, size - j);
size_t sz = MIN(blockSize, size - j);
memcpy( ptr + j, scalar, sz );
}
}
@@ -316,13 +316,13 @@ Mat& Mat::setTo(InputArray _value, InputArray _mask)
static void
flipHoriz( const uchar* src, size_t sstep, uchar* dst, size_t dstep, Size size, size_t esz )
{
int i, j, limit = ((size.width + 1)/2)*esz;
int i, j, limit = (int)(((size.width + 1)/2)*esz);
AutoBuffer<int> _tab(size.width*esz);
int* tab = _tab;
for( i = 0; i < size.width; i++ )
for( size_t k = 0; k < esz; k++ )
tab[i*esz + k] = (size.width - i - 1)*esz + k;
tab[i*esz + k] = (int)((size.width - i - 1)*esz + k);
for( ; size.height--; src += sstep, dst += dstep )
{

View File

@@ -3945,7 +3945,7 @@ void KDTree::findOrthoRange(InputArray _lowerBound,
if( _neighborsIdx.needed() )
{
_neighborsIdx.create(idx.size(), 1, CV_32S, -1, true);
_neighborsIdx.create((int)idx.size(), 1, CV_32S, -1, true);
Mat nidx = _neighborsIdx.getMat();
Mat(nidx.size(), CV_32S, &idx[0]).copyTo(nidx);
}

View File

@@ -2026,7 +2026,7 @@ void cv::fillPoly(InputOutputArray _img, InputArrayOfArrays pts,
const Scalar& color, int lineType, int shift, Point offset)
{
Mat img = _img.getMat();
size_t i, ncontours = pts.total();
int i, ncontours = (int)pts.total();
if( ncontours == 0 )
return;
AutoBuffer<Point*> _ptsptr(ncontours);
@@ -2050,7 +2050,7 @@ void cv::polylines(InputOutputArray _img, InputArrayOfArrays pts,
int thickness, int lineType, int shift )
{
Mat img = _img.getMat();
size_t i, ncontours = pts.total();
int i, ncontours = (int)pts.total();
if( ncontours == 0 )
return;
AutoBuffer<Point*> _ptsptr(ncontours);

View File

@@ -2713,7 +2713,7 @@ double Mat::dot(InputArray _mat) const
{
size_t len = total()*cn;
if( len == (size_t)(int)len )
return func(data, mat.data, len);
return func(data, mat.data, (int)len);
}
const Mat* arrays[] = {this, &mat, 0};

View File

@@ -928,7 +928,7 @@ void _InputArray::getMatVector(vector<Mat>& mv) const
if( k == MAT )
{
const Mat& m = *(const Mat*)obj;
size_t i, n = m.size[0];
int i, n = (int)m.size[0];
mv.resize(n);
for( i = 0; i < n; i++ )
@@ -940,7 +940,7 @@ void _InputArray::getMatVector(vector<Mat>& mv) const
if( k == EXPR )
{
Mat m = *(const MatExpr*)obj;
size_t i, n = m.size[0];
int i, n = m.size[0];
mv.resize(n);
for( i = 0; i < n; i++ )
@@ -980,7 +980,7 @@ void _InputArray::getMatVector(vector<Mat>& mv) const
if( k == STD_VECTOR_VECTOR )
{
const vector<vector<uchar> >& vv = *(const vector<vector<uchar> >*)obj;
size_t i, n = vv.size();
int i, n = (int)vv.size();
int t = CV_MAT_TYPE(flags);
mv.resize(n);
@@ -2795,7 +2795,7 @@ NAryMatIterator& NAryMatIterator::operator ++()
const Mat& A = *arrays[i];
if( !A.data )
continue;
int _idx = idx;
int _idx = (int)idx;
uchar* data = A.data;
for( int j = iterdepth-1; j >= 0 && _idx > 0; j-- )
{

View File

@@ -590,7 +590,7 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
}
double scale = nz0 ? 1./nz0 : 0.;
for( int k = 0; k < cn; k++ )
for( k = 0; k < cn; k++ )
{
s[k] *= scale;
sq[k] = std::sqrt(std::max(sq[k]*scale - s[k]*s[k], 0.));

View File

@@ -559,7 +559,8 @@ static void inRange(const Mat& src, const Mat& lb, const Mat& rb, Mat& dst)
NAryMatIterator it(arrays, planes);
size_t total = planes[0].total();
int i, nplanes = it.nplanes, depth = src.depth(), cn = src.channels();
size_t i, nplanes = it.nplanes;
int depth = src.depth(), cn = src.channels();
for( i = 0; i < nplanes; i++, ++it )
{
@@ -606,7 +607,8 @@ static void inRangeS(const Mat& src, const Scalar& lb, const Scalar& rb, Mat& ds
NAryMatIterator it(arrays, planes);
size_t total = planes[0].total();
int i, nplanes = it.nplanes, depth = src.depth(), cn = src.channels();
size_t i, nplanes = it.nplanes;
int depth = src.depth(), cn = src.channels();
double lbuf[4], rbuf[4];
int wtype = CV_MAKETYPE(depth <= CV_32S ? CV_32S : depth, cn);
scalarToRawData(lb, lbuf, wtype, cn);
@@ -900,7 +902,8 @@ static void exp(const Mat& src, Mat& dst)
NAryMatIterator it(arrays, planes);
size_t j, total = planes[0].total()*src.channels();
int i, nplanes = it.nplanes, depth = src.depth();
size_t i, nplanes = it.nplanes;
int depth = src.depth();
for( i = 0; i < nplanes; i++, ++it )
{
@@ -928,7 +931,8 @@ static void log(const Mat& src, Mat& dst)
NAryMatIterator it(arrays, planes);
size_t j, total = planes[0].total()*src.channels();
int i, nplanes = it.nplanes, depth = src.depth();
size_t i, nplanes = it.nplanes;
int depth = src.depth();
for( i = 0; i < nplanes; i++, ++it )
{
@@ -1017,7 +1021,8 @@ static void cartToPolar(const Mat& mx, const Mat& my, Mat& mmag, Mat& mangle, bo
NAryMatIterator it(arrays, planes);
size_t j, total = planes[0].total();
int i, nplanes = it.nplanes, depth = mx.depth();
size_t i, nplanes = it.nplanes;
int depth = mx.depth();
double scale = angleInDegrees ? 180/CV_PI : 1;
for( i = 0; i < nplanes; i++, ++it )
@@ -1260,8 +1265,8 @@ struct MinMaxLocOp : public BaseElemWiseOp
void saveOutput(const vector<int>& minidx, const vector<int>& maxidx,
double minval, double maxval, Mat& dst)
{
size_t i, ndims = minidx.size();
dst.create(1, (int)(ndims*2 + 2), CV_64FC1);
int i, ndims = (int)minidx.size();
dst.create(1, ndims*2 + 2, CV_64FC1);
for( i = 0; i < ndims; i++ )
{

View File

@@ -170,9 +170,9 @@ static void DCT_1D( const Mat& _src, Mat& _dst, int flags, const Mat& _wave=Mat(
w = wave.ptr<double>();
if( !_src.isContinuous() )
srcstep = _src.step/_src.elemSize();
srcstep = (int)(_src.step/_src.elemSize());
if( !_dst.isContinuous() )
dststep = _dst.step/_dst.elemSize();
dststep = (int)(_dst.step/_dst.elemSize());
if( _src.type() == CV_32FC1 )
{
@@ -279,10 +279,10 @@ static void convertFromCCS( const Mat& _src0, const Mat& _src1, Mat& _dst, int f
int srcstep = cn, dststep = 1;
if( !_dst.isContinuous() )
dststep = _dst.step/_dst.elemSize();
dststep = (int)(_dst.step/_dst.elemSize());
if( !_src0.isContinuous() )
srcstep = _src0.step/_src0.elemSize1();
srcstep = (int)(_src0.step/_src0.elemSize1());
if( _dst.depth() == CV_32F )
{

View File

@@ -1954,7 +1954,7 @@ void Core_SVDTest::prepare_to_validation( int /*test_case_idx*/ )
}
w = &test_mat[TEMP][0];
step = w->rows == 1 ? 1 : w->step1();
step = w->rows == 1 ? 1 : (int)w->step1();
for( i = 0; i < min_size; i++ )
{
double normval = 0, aii;