added more helper macros to the function declarations, to assist the Python wrapper generator. Fixed memleak in Mat::operator()(Range,Range) and the related functions (Mat::row, Mat::col etc.)

This commit is contained in:
Vadim Pisarevsky
2010-10-27 18:26:39 +00:00
parent 4c29ffecc0
commit 83f6085773
18 changed files with 685 additions and 987 deletions

View File

@@ -1530,8 +1530,6 @@ void compare( const Mat& src1, double value, Mat& dst, int cmpOp )
binarySOpC1_<CmpGE<double> >, 0},
};
dst.create(src1.rows, src1.cols, CV_8U);
CV_Assert(src1.channels() == 1);
int depth = src1.depth();
bool invflag = false;
@@ -1562,7 +1560,7 @@ void compare( const Mat& src1, double value, Mat& dst, int cmpOp )
if( src1.dims > 2 )
{
dst.create(src1.dims, src1.size, CV_8U);
dst.create(src1.dims, src1.size, CV_8UC(src1.channels()));
const Mat* arrays[] = {&src1, &dst, 0};
Mat planes[2];
NAryMatIterator it(arrays, planes);
@@ -1576,6 +1574,7 @@ void compare( const Mat& src1, double value, Mat& dst, int cmpOp )
return;
}
dst.create(src1.rows, src1.cols, CV_8UC(src1.channels()));
func( src1, dst, value );
if( invflag )
bitwise_not(dst, dst);

View File

@@ -268,8 +268,6 @@ Mat::Mat(const Mat& m, const Range& rowRange, const Range& colRange)
if( rows == 1 )
flags |= CONTINUOUS_FLAG;
if( refcount )
CV_XADD(refcount, 1);
if( rows <= 0 || cols <= 0 )
{
release();
@@ -737,6 +735,16 @@ Mat Mat::reshape(int new_cn, int new_rows) const
}
int Mat::checkVector(int _elemChannels, int _depth, bool _requireContinuous) const
{
return (depth() == _depth || _depth <= 0) &&
(isContinuous() || !_requireContinuous) &&
((dims == 2 && (((rows == 1 || cols == 1) && channels() == _elemChannels) || (cols == _elemChannels))) ||
(dims == 3 && channels() == 1 && size.p[2] == _elemChannels && (size.p[0] == 1 || size.p[1] == 1) &&
(isContinuous() || step.p[1] == step.p[2]*size.p[2])))
? (int)(total()*channels()/_elemChannels) : -1;
}
/*************************************************************************************************\
Matrix Operations
\*************************************************************************************************/