if( solver.state == CvLevMarq::CALC_J )
{
int iofs = (nimages+1)*6 + k*NINTRINSIC, eofs = (i+1)*6;
- assert( JtJ && JtErr );
+ CV_Assert( JtJ && JtErr );
Mat _JtJ(cvarrToMat(JtJ)), _JtErr(cvarrToMat(JtErr));
CvMat Qx = cvMat(3, 3, CV_64F, _Qx);
cvMatMul(&M, &Qx, &R);
- assert(fabs(matR[2][1]) < FLT_EPSILON);
+ CV_DbgAssert(fabs(matR[2][1]) < FLT_EPSILON);
matR[2][1] = 0;
/* Find Givens rotation for y axis. */
CvMat Qy = cvMat(3, 3, CV_64F, _Qy);
cvMatMul(&R, &Qy, &M);
- assert(fabs(matM[2][0]) < FLT_EPSILON);
+ CV_DbgAssert(fabs(matM[2][0]) < FLT_EPSILON);
matM[2][0] = 0;
/* Find Givens rotation for z axis. */
CvMat Qz = cvMat(3, 3, CV_64F, _Qz);
cvMatMul(&M, &Qz, &R);
- assert(fabs(matR[1][0]) < FLT_EPSILON);
+ CV_DbgAssert(fabs(matR[1][0]) < FLT_EPSILON);
matR[1][0] = 0;
// Solve the decomposition ambiguity.
{
matJ = _err = 0;
- assert( !err.empty() );
+ CV_Assert( !err.empty() );
if( state == DONE )
{
_param = param;
return true;
}
- assert( state == CHECK_ERR );
+ CV_Assert( state == CHECK_ERR );
errNorm = cvNorm( err, 0, CV_L2 );
if( errNorm > prevErrNorm )
{
return true;
}
- assert( state == CHECK_ERR );
+ CV_Assert( state == CHECK_ERR );
if( errNorm > prevErrNorm )
{
if( ++lambdaLg10 <= 16 )
perViewErrorsMat,
flags );
- assert( stdDevsMatInt.type() == CV_64F );
- assert( stdDevsMatInt.total() == static_cast<size_t>(CV_CALIB_NINTRINSIC) );
+ CV_Assert( stdDevsMatInt.type() == CV_64F );
+ CV_Assert( stdDevsMatInt.total() == static_cast<size_t>(CV_CALIB_NINTRINSIC) );
memcpy( stdDevs, stdDevsMatInt.ptr(), CV_CALIB_NINTRINSIC*sizeof(double) );
- assert( stdDevsMatExt.type() == CV_64F );
- assert( stdDevsMatExt.total() == static_cast<size_t>(6*imageCount) );
+ CV_Assert( stdDevsMatExt.type() == CV_64F );
+ CV_Assert( stdDevsMatExt.total() == static_cast<size_t>(6*imageCount) );
memcpy( stdDevs + CV_CALIB_NINTRINSIC, stdDevsMatExt.ptr(), 6*imageCount*sizeof(double) );
- assert( perViewErrorsMat.type() == CV_64F);
- assert( perViewErrorsMat.total() == static_cast<size_t>(imageCount) );
+ CV_Assert( perViewErrorsMat.type() == CV_64F);
+ CV_Assert( perViewErrorsMat.total() == static_cast<size_t>(imageCount) );
memcpy( perViewErrors, perViewErrorsMat.ptr(), imageCount*sizeof(double) );
- assert( cameraMatrix.type() == CV_64FC1 );
+ CV_Assert( cameraMatrix.type() == CV_64FC1 );
memcpy( _cameraMatrix, cameraMatrix.ptr(), 9*sizeof(double) );
- assert( cameraMatrix.type() == CV_64FC1 );
+ CV_Assert( cameraMatrix.type() == CV_64FC1 );
memcpy( _distortionCoeffs, distCoeffs.ptr(), 4*sizeof(double) );
vector<Mat>::iterator rvecsIt = rvecs.begin();
vector<Mat>::iterator tvecsIt = tvecs.begin();
double *rm = rotationMatrices,
*tm = translationVectors;
- assert( rvecsIt->type() == CV_64FC1 );
- assert( tvecsIt->type() == CV_64FC1 );
+ CV_Assert( rvecsIt->type() == CV_64FC1 );
+ CV_Assert( tvecsIt->type() == CV_64FC1 );
for( int i = 0; i < imageCount; ++rvecsIt, ++tvecsIt, i++, rm+=9, tm+=3 )
{
Mat r9( 3, 3, CV_64FC1 );
imgPoints, dpdrot, dpdt, dpdf, dpdc, dpddist, 0 );
// calculate and check image points
- assert( (int)imgPoints.size() == pointCount );
+ CV_Assert( (int)imgPoints.size() == pointCount );
vector<Point2f>::const_iterator it = imgPoints.begin();
for( int i = 0; i < pointCount; i++, ++it )
{
if( jacobian )
{
- assert( (jacobian->rows == 9 && jacobian->cols == 3) ||
+ CV_Assert( (jacobian->rows == 9 && jacobian->cols == 3) ||
(jacobian->rows == 3 && jacobian->cols == 9) );
}
double r[3], theta;
CvMat _r = cvMat( src->rows, src->cols, CV_MAKETYPE(CV_64F,CV_MAT_CN(src->type)), r);
- assert( dst->rows == 3 && dst->cols == 3 );
+ CV_Assert( dst->rows == 3 && dst->cols == 3 );
cvConvert( src, &_r );
}
else
{
- assert(0);
+ CV_Assert(0);
return 0;
}
}
else
{
- assert( count == dst.cols );
+ CV_Assert( count == dst.cols );
ddims = dst.channels()*dst.rows;
if( dst.rows == 1 )
{
{
string dataPath = ts->get_data_path() + "cv/";
string algorithmName = name;
- assert( !algorithmName.empty() );
+ CV_Assert( !algorithmName.empty() );
if( dataPath.empty() )
{
ts->printf( cvtest::TS::LOG, "dataPath is empty" );
{
// rightDisp is not used in current test virsion
int code = cvtest::TS::OK;
- assert( fs.isOpened() );
- assert( trueLeftDisp.type() == CV_32FC1 );
- assert( trueRightDisp.empty() || trueRightDisp.type() == CV_32FC1 );
- assert( leftDisp.type() == CV_32FC1 && (rightDisp.empty() || rightDisp.type() == CV_32FC1) );
+ CV_Assert( fs.isOpened() );
+ CV_Assert( trueLeftDisp.type() == CV_32FC1 );
+ CV_Assert( trueRightDisp.empty() || trueRightDisp.type() == CV_32FC1 );
+ CV_Assert( leftDisp.type() == CV_32FC1 && (rightDisp.empty() || rightDisp.type() == CV_32FC1) );
// get masks for unknown ground truth disparity values
Mat leftUnknMask, rightUnknMask;
DatasetParams params = datasetsParams[caseDatasets[caseIdx]];
absdiff( trueLeftDisp, Scalar(params.dispUnknVal), leftUnknMask );
leftUnknMask = leftUnknMask < std::numeric_limits<float>::epsilon();
- assert(leftUnknMask.type() == CV_8UC1);
+ CV_Assert(leftUnknMask.type() == CV_8UC1);
if( !trueRightDisp.empty() )
{
absdiff( trueRightDisp, Scalar(params.dispUnknVal), rightUnknMask );
rightUnknMask = rightUnknMask < std::numeric_limits<float>::epsilon();
- assert(rightUnknMask.type() == CV_8UC1);
+ CV_Assert(rightUnknMask.type() == CV_8UC1);
}
// calculate errors
}
datasetsParams.clear();
FileNode fn = fs.getFirstTopLevelNode();
- assert(fn.isSeq());
+ CV_Assert(fn.isSeq());
for( int i = 0; i < (int)fn.size(); i+=3 )
{
String _name = fn[i];
void CV_StereoMatchingTest::writeErrors( const string& errName, const vector<float>& errors, FileStorage* fs )
{
- assert( (int)errors.size() == ERROR_KINDS_COUNT );
+ CV_Assert( (int)errors.size() == ERROR_KINDS_COUNT );
vector<float>::const_iterator it = errors.begin();
if( fs )
for( int i = 0; i < ERROR_KINDS_COUNT; i++, ++it )
int CV_StereoMatchingTest::compareErrors( const vector<float>& calcErrors, const vector<float>& validErrors,
const vector<float>& eps, const string& errName )
{
- assert( (int)calcErrors.size() == ERROR_KINDS_COUNT );
- assert( (int)validErrors.size() == ERROR_KINDS_COUNT );
- assert( (int)eps.size() == ERROR_KINDS_COUNT );
+ CV_Assert( (int)calcErrors.size() == ERROR_KINDS_COUNT );
+ CV_Assert( (int)validErrors.size() == ERROR_KINDS_COUNT );
+ CV_Assert( (int)eps.size() == ERROR_KINDS_COUNT );
vector<float>::const_iterator calcIt = calcErrors.begin(),
validIt = validErrors.begin(),
epsIt = eps.begin();
{
int code = CV_StereoMatchingTest::readRunParams( fs );
FileNode fn = fs.getFirstTopLevelNode();
- assert(fn.isSeq());
+ CV_Assert(fn.isSeq());
for( int i = 0; i < (int)fn.size(); i+=5 )
{
String caseName = fn[i], datasetName = fn[i+1];
Rect& calcROI, Mat& leftDisp, Mat& /*rightDisp*/, int caseIdx )
{
RunParams params = caseRunParams[caseIdx];
- assert( params.ndisp%16 == 0 );
- assert( _leftImg.type() == CV_8UC3 && _rightImg.type() == CV_8UC3 );
+ CV_Assert( params.ndisp%16 == 0 );
+ CV_Assert( _leftImg.type() == CV_8UC3 && _rightImg.type() == CV_8UC3 );
Mat leftImg; cvtColor( _leftImg, leftImg, COLOR_BGR2GRAY );
Mat rightImg; cvtColor( _rightImg, rightImg, COLOR_BGR2GRAY );
{
int code = CV_StereoMatchingTest::readRunParams(fs);
FileNode fn = fs.getFirstTopLevelNode();
- assert(fn.isSeq());
+ CV_Assert(fn.isSeq());
for( int i = 0; i < (int)fn.size(); i+=5 )
{
String caseName = fn[i], datasetName = fn[i+1];
Rect& calcROI, Mat& leftDisp, Mat& /*rightDisp*/, int caseIdx )
{
RunParams params = caseRunParams[caseIdx];
- assert( params.ndisp%16 == 0 );
+ CV_Assert( params.ndisp%16 == 0 );
Ptr<StereoSGBM> sgbm = StereoSGBM::create( 0, params.ndisp, params.winSize,
10*params.winSize*params.winSize,
40*params.winSize*params.winSize,
void operator=(const WImage&);
explicit WImage(IplImage* img) : image_(img) {
- assert(!img || img->depth == Depth());
+ CV_Assert(!img || img->depth == Depth());
}
void SetIpl(IplImage* image) {
- assert(!image || image->depth == Depth());
+ CV_Assert(!image || image->depth == Depth());
image_ = image;
}
enum { kChannels = C };
explicit WImageC(IplImage* img) : WImage<T>(img) {
- assert(!img || img->nChannels == Channels());
+ CV_Assert(!img || img->nChannels == Channels());
}
// Construct a view into a region of this image
void operator=(const WImageC&);
void SetIpl(IplImage* image) {
- assert(!image || image->depth == WImage<T>::Depth());
+ CV_Assert(!image || image->depth == WImage<T>::Depth());
WImage<T>::SetIpl(image);
}
};
// returns zero value if iteration is finished, non-zero otherwise
CV_IMPL int cvNextNArraySlice( CvNArrayIterator* iterator )
{
- assert( iterator != 0 );
+ CV_Assert( iterator != 0 );
int i, dims;
for( dims = iterator->dims; dims > 0; dims-- )
int i, tabidx;
unsigned hashval = 0;
CvSparseNode *node;
- assert( CV_IS_SPARSE_MAT( mat ));
+ CV_Assert( CV_IS_SPARSE_MAT( mat ));
if( !precalc_hashval )
{
int newrawsize = newsize*sizeof(newtable[0]);
CvSparseMatIterator iterator;
- assert( (newsize & (newsize - 1)) == 0 );
+ CV_Assert( (newsize & (newsize - 1)) == 0 );
// resize hash table
newtable = (void**)cvAlloc( newrawsize );
int i, tabidx;
unsigned hashval = 0;
CvSparseNode *node, *prev = 0;
- assert( CV_IS_SPARSE_MAT( mat ));
+ CV_Assert( CV_IS_SPARSE_MAT( mat ));
if( !precalc_hashval )
{
int cn = CV_MAT_CN( type );
int depth = type & CV_MAT_DEPTH_MASK;
- assert( scalar && data );
+ CV_Assert( scalar && data );
if( (unsigned)(cn - 1) >= 4 )
CV_Error( CV_StsOutOfRange, "The number of channels must be 1, 2, 3 or 4" );
((double*)data)[cn] = (double)(scalar->val[cn]);
break;
default:
- assert(0);
+ CV_Assert(0);
CV_Error( CV_BadDepth, "" );
}
{
int cn = CV_MAT_CN( flags );
- assert( scalar && data );
+ CV_Assert( scalar && data );
if( (unsigned)(cn - 1) >= 4 )
CV_Error( CV_StsOutOfRange, "The number of channels must be 1, 2, 3 or 4" );
scalar->val[cn] = ((double*)data)[cn];
break;
default:
- assert(0);
+ CV_Assert(0);
CV_Error( CV_BadDepth, "" );
}
}
{
CvMatND* mat = (CvMatND*)arr;
- assert( new_cn > 0 );
+ CV_Assert( new_cn > 0 );
int last_dim_size = mat->dim[mat->dims-1].size*CV_MAT_CN(mat->type);
int new_size = last_dim_size/new_cn;
cvCreateImage( CvSize size, int depth, int channels )
{
IplImage *img = cvCreateImageHeader( size, depth, channels );
- assert( img );
+ CV_Assert( img );
cvCreateData( img );
return img;
block_size = CV_STORAGE_BLOCK_SIZE;
block_size = cvAlign( block_size, CV_STRUCT_ALIGN );
- assert( sizeof(CvMemBlock) % CV_STRUCT_ALIGN == 0 );
+ CV_Assert( sizeof(CvMemBlock) % CV_STRUCT_ALIGN == 0 );
memset( storage, 0, sizeof( *storage ));
storage->signature = CV_STORAGE_MAGIC_VAL;
if( block == parent->top ) /* the single allocated block */
{
- assert( parent->bottom == block );
+ CV_Assert( parent->bottom == block );
parent->top = parent->bottom = 0;
parent->free_space = 0;
}
if( storage->top->next )
storage->top = storage->top->next;
storage->free_space = storage->block_size - sizeof(CvMemBlock);
- assert( storage->free_space % CV_STRUCT_ALIGN == 0 );
+ CV_Assert( storage->free_space % CV_STRUCT_ALIGN == 0 );
}
if( size > INT_MAX )
CV_Error( CV_StsOutOfRange, "Too large memory block is requested" );
- assert( storage->free_space % CV_STRUCT_ALIGN == 0 );
+ CV_Assert( storage->free_space % CV_STRUCT_ALIGN == 0 );
if( (size_t)storage->free_space < size )
{
}
ptr = ICV_FREE_PTR(storage);
- assert( (size_t)ptr % CV_STRUCT_ALIGN == 0 );
+ CV_Assert( (size_t)ptr % CV_STRUCT_ALIGN == 0 );
storage->free_space = cvAlignLeft(storage->free_space - (int)size, CV_STRUCT_ALIGN );
return ptr;
else
{
icvGoNextMemBlock( storage );
- assert( storage->free_space >= delta );
+ CV_Assert( storage->free_space >= delta );
}
}
* For used blocks it means current number
* of sequence elements in the block:
*/
- assert( block->count % seq->elem_size == 0 && block->count > 0 );
+ CV_Assert( block->count % seq->elem_size == 0 && block->count > 0 );
if( !in_front_of )
{
if( block != block->prev )
{
- assert( seq->first->start_index == 0 );
+ CV_Assert( seq->first->start_index == 0 );
seq->first = block;
}
else
{
CvSeqBlock *block = seq->first;
- assert( (in_front_of ? block : block->prev)->count == 0 );
+ CV_Assert( (in_front_of ? block : block->prev)->count == 0 );
if( block == block->prev ) /* single block case */
{
if( !in_front_of )
{
block = block->prev;
- assert( seq->ptr == block->data );
+ CV_Assert( seq->ptr == block->data );
block->count = (int)(seq->block_max - seq->ptr);
seq->block_max = seq->ptr = block->prev->data +
block->next->prev = block->prev;
}
- assert( block->count > 0 && block->count % seq->elem_size == 0 );
+ CV_Assert( block->count > 0 && block->count % seq->elem_size == 0 );
block->next = seq->free_blocks;
seq->free_blocks = block;
}
CvSeqBlock *block = first_block;
writer->block->count = (int)((writer->ptr - writer->block->data) / seq->elem_size);
- assert( writer->block->count > 0 );
+ CV_Assert( writer->block->count > 0 );
do
{
CvMemStorage *storage = seq->storage;
schar *storage_block_max = (schar *) storage->top + storage->block_size;
- assert( writer->block->count > 0 );
+ CV_Assert( writer->block->count > 0 );
if( (unsigned)((storage_block_max - storage->free_space)
- seq->block_max) < CV_STRUCT_ALIGN )
icvGrowSeq( seq, 0 );
ptr = seq->ptr;
- assert( ptr + elem_size <= seq->block_max /*&& ptr == seq->block_min */ );
+ CV_Assert( ptr + elem_size <= seq->block_max /*&& ptr == seq->block_min */ );
}
if( element )
if( --(seq->first->prev->count) == 0 )
{
icvFreeSeqBlock( seq, 0 );
- assert( seq->ptr == seq->block_max );
+ CV_Assert( seq->ptr == seq->block_max );
}
}
icvGrowSeq( seq, 1 );
block = seq->first;
- assert( block->start_index > 0 );
+ CV_Assert( block->start_index > 0 );
}
ptr = block->data -= elem_size;
icvGrowSeq( seq, 0 );
ptr = seq->ptr + elem_size;
- assert( ptr <= seq->block_max );
+ CV_Assert( ptr <= seq->block_max );
}
delta_index = seq->first->start_index;
block = prev_block;
/* Check that we don't fall into an infinite loop: */
- assert( block != seq->first->prev );
+ CV_Assert( block != seq->first->prev );
}
before_index = (before_index - block->start_index + delta_index) * elem_size;
block = next_block;
/* Check that we don't fall into an infinite loop: */
- assert( block != seq->first );
+ CV_Assert( block != seq->first );
}
before_index = (before_index - block->start_index + delta_index) * elem_size;
icvGrowSeq( seq, 1 );
block = seq->first;
- assert( block->start_index > 0 );
+ CV_Assert( block->start_index > 0 );
}
delta = MIN( block->start_index, count );
int delta = seq->first->prev->count;
delta = MIN( delta, count );
- assert( delta > 0 );
+ CV_Assert( delta > 0 );
seq->first->prev->count -= delta;
seq->total -= delta;
int delta = seq->first->count;
delta = MIN( delta, count );
- assert( delta > 0 );
+ CV_Assert( delta > 0 );
seq->first->count -= delta;
seq->total -= delta;
root2->rank += root->rank == root2->rank;
root = root2;
}
- assert( root->parent == 0 );
+ CV_Assert( root->parent == 0 );
// Compress path from node2 to the root:
while( node2->parent )
((CvSetElem*)ptr)->flags = count | CV_SET_ELEM_FREE_FLAG;
((CvSetElem*)ptr)->next_free = (CvSetElem*)(ptr + elem_size);
}
- assert( count <= CV_SET_ELEM_IDX_MASK+1 );
+ CV_Assert( count <= CV_SET_ELEM_IDX_MASK+1 );
((CvSetElem*)(ptr - elem_size))->next_free = 0;
set->first->prev->count += count - set->total;
set->total = count;
for( ; edge; edge = edge->next[ofs] )
{
ofs = start_vtx == edge->vtx[1];
- assert( ofs == 1 || start_vtx == edge->vtx[0] );
+ CV_Assert( ofs == 1 || start_vtx == edge->vtx[0] );
if( edge->vtx[1] == end_vtx )
break;
}
"vertex pointers coincide (or set to NULL)" );
edge = (CvGraphEdge*)cvSetNew( (CvSet*)(graph->edges) );
- assert( edge->flags >= 0 );
+ CV_Assert( edge->flags >= 0 );
edge->vtx[0] = start_vtx;
edge->vtx[1] = end_vtx;
prev_ofs = ofs, prev_edge = edge, edge = edge->next[ofs] )
{
ofs = start_vtx == edge->vtx[1];
- assert( ofs == 1 || start_vtx == edge->vtx[0] );
+ CV_Assert( ofs == 1 || start_vtx == edge->vtx[0] );
if( edge->vtx[1] == end_vtx )
break;
}
prev_ofs = ofs, prev_edge = edge, edge = edge->next[ofs] )
{
ofs = end_vtx == edge->vtx[1];
- assert( ofs == 1 || end_vtx == edge->vtx[0] );
+ CV_Assert( ofs == 1 || end_vtx == edge->vtx[0] );
if( edge->vtx[0] == start_vtx )
break;
}
node->v_prev = _parent != _frame ? parent : 0;
node->h_next = parent->v_next;
- assert( parent->v_next != node );
+ CV_Assert( parent->v_next != node );
if( parent->v_next )
parent->v_next->h_prev = node;
if( parent )
{
- assert( parent->v_next == node );
+ CV_Assert( parent->v_next == node );
parent->v_next = node->h_next;
}
}
else
{
// radix[] is initialized from index 'nf' down to zero
- assert (nf < 34);
+ CV_Assert (nf < 34);
radix[nf] = 1;
digits[nf] = 0;
for( i = 0; i < nf; i++ )
else
{
Complex<float>* wave = (Complex<float>*)_wave;
- assert( elem_size == sizeof(Complex<float>) );
+ CV_Assert( elem_size == sizeof(Complex<float>) );
wave[0].re = 1.f;
wave[0].im = 0.f;
// 0. shuffle data
if( dst != src )
{
- assert( !c.noPermute );
+ CV_Assert( !c.noPermute );
if( !inv )
{
for( i = 0; i <= n - 2; i += 2, itab += 2*tab_step )
{
int k0 = itab[0], k1 = itab[tab_step];
- assert( (unsigned)k0 < (unsigned)n && (unsigned)k1 < (unsigned)n );
+ CV_Assert( (unsigned)k0 < (unsigned)n && (unsigned)k1 < (unsigned)n );
dst[i] = src[k0]; dst[i+1] = src[k1];
}
for( i = 0; i <= n - 2; i += 2, itab += 2*tab_step )
{
int k0 = itab[0], k1 = itab[tab_step];
- assert( (unsigned)k0 < (unsigned)n && (unsigned)k1 < (unsigned)n );
+ CV_Assert( (unsigned)k0 < (unsigned)n && (unsigned)k1 < (unsigned)n );
t.re = src[k0].re; t.im = -src[k0].im;
dst[i] = t;
t.re = src[k1].re; t.im = -src[k1].im;
for( i = 0; i < n2; i += 2, itab += tab_step*2 )
{
j = itab[0];
- assert( (unsigned)j < (unsigned)n2 );
+ CV_Assert( (unsigned)j < (unsigned)n2 );
CV_SWAP(dst[i+1], dsth[j], t);
if( j > i )
for( i = 0; i < n; i++, itab += tab_step )
{
j = itab[0];
- assert( (unsigned)j < (unsigned)n );
+ CV_Assert( (unsigned)j < (unsigned)n );
if( j > i )
CV_SWAP(dst[i], dst[j], t);
}
setIppErrorStatus();
#endif
}
- assert( c.tab_size == n );
+ CV_Assert( c.tab_size == n );
if( n == 1 )
{
T save_s1 = 0.;
T t0, t1, t2, t3, t;
- assert( c.tab_size == n );
+ CV_Assert( c.tab_size == n );
if( complex_input )
{
- assert( src != dst );
+ CV_Assert( src != dst );
save_s1 = src[1];
((T*)src)[1] = src[0];
src++;
}
else
{
- assert( !inv );
+ CV_Assert( !inv );
CopyColumn( dbuf0, complex_elem_size, dptr0,
dst_step, len, complex_elem_size );
if( even )
if( n == 1 )
return;
- assert( (n&1) == 0 );
+ CV_Assert( (n&1) == 0 );
if( (n & (n - 1)) == 0 )
{
else
{
Complex<float>* wave = (Complex<float>*)_wave;
- assert( elem_size == sizeof(Complex<float>) );
+ CV_Assert( elem_size == sizeof(Complex<float>) );
w.re = (float)scale;
w.im = 0.f;
}
else
{
- assert( n == 1 );
+ CV_Assert( n == 1 );
if( type == CV_32FC1 )
{
}
else
{
- assert( src.rows == 1 );
+ CV_Assert( src.rows == 1 );
if( type == CV_32FC1 )
{
}
break;
default:
- assert(0);
+ CV_Assert(0);
return;
}
}
if( delta && delta_cols < size.width )
{
- assert( delta_cols == 1 );
+ CV_Assert( delta_cols == 1 );
buf_size *= 5;
}
buf.allocate(buf_size);
uchar* SparseMat::newNode(const int* idx, size_t hashval)
{
const int HASH_MAX_FILL_FACTOR=3;
- assert(hdr);
+ CV_Assert(hdr);
size_t hsize = hdr->hashtab.size();
if( ++hdr->nodeCount > hsize*HASH_MAX_FILL_FACTOR )
{
static void* openclamdblas_check_fn(int ID)
{
- assert(ID >= 0 && ID < (int)(sizeof(openclamdblas_fn)/sizeof(openclamdblas_fn[0])));
+ CV_Assert(ID >= 0 && ID < (int)(sizeof(openclamdblas_fn)/sizeof(openclamdblas_fn[0])));
const struct DynamicFnEntry* e = openclamdblas_fn[ID];
void* func = CV_CL_GET_PROC_ADDRESS(e->fnName);
if (!func)
static void* openclamdfft_check_fn(int ID)
{
- assert(ID >= 0 && ID < (int)(sizeof(openclamdfft_fn)/sizeof(openclamdfft_fn[0])));
+ CV_Assert(ID >= 0 && ID < (int)(sizeof(openclamdfft_fn)/sizeof(openclamdfft_fn[0])));
const struct DynamicFnEntry* e = openclamdfft_fn[ID];
void* func = CV_CL_GET_PROC_ADDRESS(e->fnName);
if (!func)
static void* opencl_gl_check_fn(int ID)
{
const struct DynamicFnEntry* e = NULL;
- assert(ID >= 0 && ID < (int)(sizeof(opencl_gl_fn_list)/sizeof(opencl_gl_fn_list[0])));
+ CV_Assert(ID >= 0 && ID < (int)(sizeof(opencl_gl_fn_list)/sizeof(opencl_gl_fn_list[0])));
e = opencl_gl_fn_list[ID];
void* func = CV_CL_GET_PROC_ADDRESS(e->fnName);
if (!func)
{
if( collection->tag != CV_NODE_NONE )
{
- assert( fs->fmt == CV_STORAGE_FORMAT_XML );
+ CV_Assert( fs->fmt == CV_STORAGE_FORMAT_XML );
CV_PARSE_ERROR( "Sequence element should not have name (use <_></_>)" );
}
if( !dt || !len )
return 0;
- assert( fmt_pairs != 0 && max_len > 0 );
+ CV_Assert( fmt_pairs != 0 && max_len > 0 );
fmt_pairs[0] = 0;
max_len *= 2;
cvSeqPop( fs->write_stack, &parent_flags );
fs->struct_indent -= 4;
fs->struct_flags = parent_flags & ~CV_NODE_EMPTY;
- assert( fs->struct_indent >= 0 );
+ CV_Assert( fs->struct_indent >= 0 );
if ( CV_NODE_IS_COLLECTION(struct_flags) )
{
cv::Size size;
int y;
- assert( CV_IS_MAT_HDR_Z(mat) );
+ CV_Assert( CV_IS_MAT_HDR_Z(mat) );
cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_MAT );
cvWriteInt( fs, "rows", mat->rows );
int dims, sizes[CV_MAX_DIM];
char dt[16];
- assert( CV_IS_MATND_HDR(mat) );
+ CV_Assert( CV_IS_MATND_HDR(mat) );
cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_MATND );
dims = cvGetDims( mat, sizes );
int *prev_idx = 0;
char dt[16];
- assert( CV_IS_SPARSE_MAT(mat) );
+ CV_Assert( CV_IS_SPARSE_MAT(mat) );
memstorage = cvCreateMemStorage();
if( i > 0 )
{
for( ; idx[k] == prev_idx[k]; k++ )
- assert( k < dims );
+ CV_Assert( k < dims );
if( k < dims - 1 )
fs->write_int( fs, 0, k - dims + 1 );
}
cv::Size size;
int y, depth;
- assert( CV_IS_IMAGE(image) );
+ CV_Assert( CV_IS_IMAGE(image) );
if( image->dataOrder == IPL_DATA_ORDER_PLANE )
CV_Error( CV_StsUnsupportedFormat,
char buf[128];
char dt_buf[128], *dt;
- assert( CV_IS_SEQ( seq ));
+ CV_Assert( CV_IS_SEQ( seq ));
cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_SEQ );
if( level >= 0 )
strcmp(recursive_value,"False") != 0 &&
strcmp(recursive_value,"FALSE") != 0;
- assert( CV_IS_SEQ( seq ));
+ CV_Assert( CV_IS_SEQ( seq ));
if( !is_recursive )
{
root = seq;
if( level > prev_level )
{
- assert( level == prev_level + 1 );
+ CV_Assert( level == prev_level + 1 );
parent = prev_seq;
prev_seq = 0;
if( parent )
char edge_dt_buf[128], *edge_dt;
int write_buf_size;
- assert( CV_IS_GRAPH(graph) );
+ CV_Assert( CV_IS_GRAPH(graph) );
vtx_count = cvGraphGetVtxCount( graph );
edge_count = cvGraphGetEdgeCount( graph );
flag_buf = (int*)cvAlloc( vtx_count*sizeof(flag_buf[0]));
if( c == '-' )
{
- assert( ptr[1] == '-' && ptr[2] == '>' );
+ CV_Assert( ptr[1] == '-' && ptr[2] == '>' );
mode = 0;
ptr += 3;
}
else if( *ptr == '!' )
{
tag_type = CV_XML_DIRECTIVE_TAG;
- assert( ptr[1] != '-' || ptr[2] != '-' );
+ CV_Assert( ptr[1] != '-' || ptr[2] != '-' );
ptr++;
}
else
}
ptr = icvXMLParseValue( fs, ptr, &stub, CV_NODE_STRING );
- assert( stub.tag == CV_NODE_STRING );
+ CV_Assert( stub.tag == CV_NODE_STRING );
last->attr[count*2+1] = stub.data.str.ptr;
count++;
}
if( !CV_NODE_IS_FLOW(parent_flags) )
fs->struct_indent -= CV_YML_INDENT + CV_NODE_IS_FLOW(struct_flags);
- assert( fs->struct_indent >= 0 );
+ CV_Assert( fs->struct_indent >= 0 );
fs->struct_flags = parent_flags;
}
static schar* cvTsSimpleSeqElem( CvTsSimpleSeq* seq, int index )
{
- assert( 0 <= index && index < seq->count );
+ CV_Assert( 0 <= index && index < seq->count );
return seq->array + index * seq->elem_size;
}
if( from_idx == to_idx )
return;
- assert( (from_idx > to_idx && !elem) || (from_idx < to_idx && elem) );
+
+ if (elem)
+ CV_Assert(from_idx < to_idx);
+ else
+ CV_Assert(from_idx > to_idx);
if( from_idx < seq->count )
{
static schar* cvTsSimpleSetFind( CvTsSimpleSet* set_header, int index )
{
int idx = index * set_header->elem_size;
- assert( 0 <= index && index < set_header->max_count );
+ CV_Assert( 0 <= index && index < set_header->max_count );
return set_header->array[idx] ? set_header->array + idx + 1 : 0;
}
static int cvTsSimpleSetAdd( CvTsSimpleSet* set_header, void* elem )
{
int idx, idx2;
- assert( set_header->free_count > 0 );
+ CV_Assert( set_header->free_count > 0 );
idx = set_header->free_stack[--set_header->free_count];
idx2 = idx * set_header->elem_size;
- assert( set_header->array[idx2] == 0 );
+ CV_Assert( set_header->array[idx2] == 0 );
set_header->array[idx2] = 1;
if( set_header->elem_size > 1 )
memcpy( set_header->array + idx2 + 1, elem, set_header->elem_size - 1 );
static void cvTsSimpleSetRemove( CvTsSimpleSet* set_header, int index )
{
- assert( set_header->free_count < set_header->max_count &&
- 0 <= index && index < set_header->max_count );
- assert( set_header->array[index * set_header->elem_size] == 1 );
+ CV_Assert( set_header->free_count < set_header->max_count &&
+ 0 <= index && index < set_header->max_count );
+ CV_Assert( set_header->array[index * set_header->elem_size] == 1 );
set_header->free_stack[set_header->free_count++] = index;
set_header->array[index * set_header->elem_size] = 0;
{
CvTsSimpleGraph* graph;
- assert( max_vtx_count > 1 && vtx_size >= 0 && edge_size >= 0 );
+ CV_Assert( max_vtx_count > 1 && vtx_size >= 0 && edge_size >= 0 );
graph = (CvTsSimpleGraph*)cvAlloc( sizeof(*graph) +
max_vtx_count * max_vtx_count * (edge_size + 1));
graph->vtx = cvTsCreateSimpleSet( max_vtx_count, vtx_size );
{
int i, t, n = graph->oriented ? 1 : 2;
- assert( cvTsSimpleSetFind( graph->vtx, idx1 ) &&
- cvTsSimpleSetFind( graph->vtx, idx2 ));
+ CV_Assert( cvTsSimpleSetFind( graph->vtx, idx1 ) &&
+ cvTsSimpleSetFind( graph->vtx, idx2 ));
for( i = 0; i < n; i++ )
{
int ofs = (idx1*graph->vtx->max_count + idx2)*graph->edge_size;
- assert( graph->matrix[ofs] == 0 );
+ CV_Assert( graph->matrix[ofs] == 0 );
graph->matrix[ofs] = 1;
if( graph->edge_size > 1 )
memcpy( graph->matrix + ofs + 1, edge, graph->edge_size - 1 );
{
int i, t, n = graph->oriented ? 1 : 2;
- assert( cvTsSimpleSetFind( graph->vtx, idx1 ) &&
+ CV_Assert( cvTsSimpleSetFind( graph->vtx, idx1 ) &&
cvTsSimpleSetFind( graph->vtx, idx2 ));
for( i = 0; i < n; i++ )
{
int ofs = (idx1*graph->vtx->max_count + idx2)*graph->edge_size;
- assert( graph->matrix[ofs] == 1 );
+ CV_Assert( graph->matrix[ofs] == 1 );
graph->matrix[ofs] = 0;
CV_SWAP( idx1, idx2, t );
}
int i, count = 0;
int edge_size = graph->edge_size;
int max_vtx_count = graph->vtx->max_count;
- assert( cvTsSimpleGraphFindVertex( graph, index ) != 0 );
+ CV_Assert( cvTsSimpleGraphFindVertex( graph, index ) != 0 );
for( i = 0; i < max_vtx_count; i++ )
{
if( !graph->oriented )
{
- assert( count % 2 == 0 );
+ CV_Assert( count % 2 == 0 );
count /= 2;
}
return count;
CvTsSimpleSeq* sseq = (CvTsSimpleSeq*)simple_struct[_struct_idx];
struct_idx = _struct_idx;
- assert( seq->total == sseq->count );
+ CV_Assert( seq->total == sseq->count );
if( sseq->count == 0 )
return 0;
vector<schar> _elem(sseq->elem_size);
schar* elem = &_elem[0];
- assert( total == sseq->count );
+ CV_Assert( total == sseq->count );
this->struct_idx = _struct_idx;
int pos = cvtest::randInt(rng) % 2;
"The sequence doesn't become empty after clear" );
break;
default:
- assert(0);
+ CV_Assert(0);
return -1;
}
for( i = 0; i < vtx_count; i++ )
cvGraphAddVtx( graph );
- assert( graph->active_count == vtx_count );
+ CV_Assert( graph->active_count == vtx_count );
for( i = 0; i < edge_count; i++ )
{
cvGraphAddEdge( graph, j, k );
}
- assert( graph->active_count == vtx_count && graph->edges->active_count <= edge_count );
+ CV_Assert( graph->active_count == vtx_count && graph->edges->active_count <= edge_count );
return 0;
}
}
}
else
- assert(0);
+ CV_Assert(0);
}
template<class Type>
void testReduce( const Mat& src, Mat& sum, Mat& avg, Mat& max, Mat& min, int dim )
{
- assert( src.channels() == 1 );
+ CV_Assert( src.channels() == 1 );
if( dim == 0 ) // row
{
sum.create( 1, src.cols, CV_64FC1 );
eps = 0.6;
}
- assert( opRes.type() == CV_64FC1 );
+ CV_Assert( opRes.type() == CV_64FC1 );
Mat _dst, dst, diff;
cv::reduce( src, _dst, dim, opType, dstType );
_dst.convertTo( dst, CV_64FC1 );
else if( srcType == CV_64FC1 )
testReduce<double>( src, sum, avg, max, min, dim );
else
- assert( 0 );
+ CV_Assert( 0 );
// 1. sum
tempCode = checkOp( src, dstType, CV_REDUCE_SUM, sum, dim );
}
else
{
- assert( mat_depth == CV_64F );
+ CV_Assert( mat_depth == CV_64F );
for( i = 0; i < transmat->rows; i++ )
for( j = 0; j < cols; j++ )
mat[i*cols + j] = ((double*)(transmat->data.ptr + transmat->step*i))[j];
buf[j] = ((double*)src)[j];
break;
default:
- assert(0);
+ CV_Assert(0);
}
switch( cn )
}
break;
default:
- assert(0);
+ CV_Assert(0);
}
switch( depth )
((double*)dst)[j] = buf[j];
break;
default:
- assert(0);
+ CV_Assert(0);
}
}
}
double *a0 = a->data.db, *b0 = b ? b->data.db : 0;
double *x0 = x ? x->data.db : 0;
double t, det = 1.;
- assert( CV_MAT_TYPE(a->type) == CV_64FC1 &&
- (!b || CV_ARE_TYPES_EQ(a,b)) && (!x || CV_ARE_TYPES_EQ(a,x)));
+ CV_Assert( CV_MAT_TYPE(a->type) == CV_64FC1 &&
+ (!b || CV_ARE_TYPES_EQ(a,b)) && (!x || CV_ARE_TYPES_EQ(a,x)));
for( i = 0; i < Nm; i++ )
{
if( x )
{
- assert( b );
+ CV_Assert( b );
for( i = N-1; i >= 0; i-- )
{
#include <vector>
#include <fstream>
#include <sys/stat.h>
-#include <assert.h>
#include "../include/common.hpp"
#include "../include/ocl4dnn.hpp"
#include "opencl_kernels_dnn.hpp"
void emptyDataTest()
{
- assert( dextractor );
+ CV_Assert( dextractor );
// One image.
Mat image;
void regressionTest()
{
- assert( dextractor );
+ CV_Assert( dextractor );
// Read the test image.
string imgFilename = string(ts->get_data_path()) + FEATURES2D_DIR + "/" + IMAGE_FILENAME;
}
}
- assert( minDist >= 0 );
+ CV_Assert( minDist >= 0 );
if( !isSimilarKeypoints( validKeypoints[v], calcKeypoints[nearestIdx] ) )
badPointCount++;
}
void CV_FeatureDetectorTest::regressionTest()
{
- assert( !fdetector.empty() );
+ CV_Assert( !fdetector.empty() );
string imgFilename = string(ts->get_data_path()) + FEATURES2D_DIR + "/" + IMAGE_FILENAME;
string resFilename = string(ts->get_data_path()) + DETECTOR_DIR + "/" + string(name) + ".xml.gz";
case 1: createIndex( data, KDTreeIndexParams() ); break;
//case 2: createIndex( data, CompositeIndexParams() ); break; // nothing to save for linear search
//case 2: createIndex( data, AutotunedIndexParams() ); break; // possible linear index !
- default: assert(0);
+ default: CV_Assert(0);
}
string filename = tempfile();
index->save( filename );
fprintf(stderr, "I can only search one feature at a time for range search\n");
return -1;
}
- assert(query.cols == veclen());
- assert(indices.cols == dists.cols);
+ CV_Assert(query.cols == veclen());
+ CV_Assert(indices.cols == dists.cols);
int n = 0;
int* indices_ptr = NULL;
#include <string.h>
#include <limits.h>
#include <ctype.h>
-#include <assert.h>
#if defined _WIN32 || defined WINCE
#include <windows.h>
if( !(exp) ) \
{ \
printf("Assertion: %s %s: %d\n", #exp, __FILE__, __LINE__);\
- assert(exp); \
+ CV_Assert(exp); \
}
static int wasInitialized = 0;
}
- assert( image_widget->scaled_image );
+ CV_Assert( image_widget->scaled_image );
}
static void
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
-#include <assert.h>
#ifdef HAVE_OPENGL
#include <memory>
static void FillBitmapInfo( BITMAPINFO* bmi, int width, int height, int bpp, int origin )
{
- assert( bmi && width >= 0 && height >= 0 && (bpp == 8 || bpp == 24 || bpp == 32));
+ CV_Assert( bmi && width >= 0 && height >= 0 && (bpp == 8 || bpp == 24 || bpp == 32));
BITMAPINFOHEADER* bmih = &(bmi->bmiHeader);
{
RECT crect = { 0 }, trect = { 0 }, rect = { 0 };
- assert(window);
+ CV_Assert(window);
GetClientRect(window->frame, &crect);
if (window->toolbar.toolbar)
static void icvUpdateWindowPos( CvWindow* window )
{
RECT rect = { 0 };
- assert(window);
+ CV_Assert(window);
if( (window->flags & CV_WINDOW_AUTOSIZE) && window->image )
{
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
-#include <assert.h>
#include <opencv2\highgui.hpp>
#include <opencv2\highgui\highgui_winrt.hpp>
#include "window_winrt_bridge.hpp"
len = i;
current = temp.next;
- assert( current );
+ CV_Assert( current );
/* Pass 1.
Determines support region for all the remained points */
int dx, dy;
Cv32suf d;
- assert( k <= len );
+ CV_Assert( k <= len );
/* calc indices */
i1 = i - k;
((double)dx2 * dx2 + (double)dy2 * dy2) ));
sk.f = (float) (temp_num + 1.1);
- assert( 0 <= sk.f && sk.f <= 2.2 );
+ CV_Assert( 0 <= sk.f && sk.f <= 2.2 );
if( j < k && sk.i <= s )
break;
/* Pass 3.
Removes non-dominant points with 1-length support region */
current = temp.next;
- assert( current );
+ CV_Assert( current );
prev_current = &temp;
do
/* Pass 4.
Cleans remained couples of points */
- assert( temp.next );
+ CV_Assert( temp.next );
if( array[0].s != 0 && array[len - 1].s != 0 ) /* specific case */
{
// gather points
current = temp.next;
- assert( current );
+ CV_Assert( current );
do
{
if( src_seq->v_next && len >= minimal_perimeter )
{
- assert( prev_contour != 0 );
+ CV_Assert( prev_contour != 0 );
parent = prev_contour;
prev_contour = 0;
src_seq = src_seq->v_next;
dx = end_pt.x - start_pt.x;
dy = end_pt.y - start_pt.y;
- assert( dx != 0 || dy != 0 );
+ CV_Assert( dx != 0 || dy != 0 );
while( pos != slice.end )
{
CV_Error( CV_StsBadArg, "Invalid approximation method" );
}
- assert( contour );
+ CV_Assert( contour );
if( header_size >= (int)sizeof(CvContour))
cvBoundingRect( contour, 1 );
if( src_seq->v_next )
{
- assert( prev_contour != 0 );
+ CV_Assert( prev_contour != 0 );
parent = prev_contour;
prev_contour = 0;
src_seq = src_seq->v_next;
}
else
{
- assert( cn == 3 );
+ CV_Assert( cn == 3 );
AutoBuffer<float> buf(alignSize(size.width, CV_SIMD_WIDTH)*3 + size.width + CV_SIMD_WIDTH - 1);
memset(buf.data(), 0, buf.size() * sizeof(float));
float *sum_b = alignPtr(buf.data(), CV_SIMD_WIDTH);
reader->ptr = ptr;
reader->code = (schar)code;
- assert( (code & ~7) == 0 );
+ CV_Assert( (code & ~7) == 0 );
reader->pt.x = pt.x + icvCodeDeltas[code].x;
reader->pt.y = pt.y + icvCodeDeltas[code].y;
}
}
/* hole flag of the parent must differ from the flag of the contour */
- assert( par_info->is_hole != is_hole );
+ CV_Assert( par_info->is_hole != is_hole );
if( par_info->contour == 0 ) /* removed contour */
goto resume_scan;
}
dx0 = (double)hull_next->x - (double)hull_cur->x;
dy0 = (double)hull_next->y - (double)hull_cur->y;
- assert( dx0 != 0 || dy0 != 0 );
+ CV_Assert( dx0 != 0 || dy0 != 0 );
scale = 1./std::sqrt(dx0*dx0 + dy0*dy0);
defect.start = hull_cur;
}
}
- assert( (c1 & c2) != 0 || (x1 | y1 | x2 | y2) >= 0 );
+ CV_Assert( (c1 & c2) != 0 || (x1 | y1 | x2 | y2) >= 0 );
}
return (c1 | c2) == 0;
if( connectivity == 8 )
{
- assert( dx >= 0 && dy >= 0 );
+ CV_Assert( dx >= 0 && dy >= 0 );
err = dx - (dy + dy);
plusDelta = dx + dx;
}
else /* connectivity == 4 */
{
- assert( dx >= 0 && dy >= 0 );
+ CV_Assert( dx >= 0 && dy >= 0 );
err = 0;
plusDelta = (dx + dx) + (dy + dy);
p0.x <<= XY_SHIFT - shift;
p0.y <<= XY_SHIFT - shift;
- assert( 0 <= shift && shift <= XY_SHIFT );
+ CV_Assert( 0 <= shift && shift <= XY_SHIFT );
xmin = xmax = v[0].x;
ymin = ymax = v[0].y;
for( i = 0; i < total; i++ )
{
PolyEdge& e1 = edges[i];
- assert( e1.y0 < e1.y1 );
+ CV_Assert( e1.y0 < e1.y1 );
// Determine x-coordinate of the end of the edge.
// (This is not necessary x-coordinate of any vertex in the array.)
int64 x1 = e1.x + (e1.y1 - e1.y0) * e1.dx;
char code;
CV_READ_SEQ_ELEM( code, reader );
- assert( (code & ~7) == 0 );
+ CV_Assert( (code & ~7) == 0 );
if( code != prev_code )
{
char *buffer, *buffer_end;
memset( state, 0, sizeof( *state ));
- assert( cost_step % sizeof(float) == 0 );
+ CV_Assert( cost_step % sizeof(float) == 0 );
cost_step /= sizeof(float);
/* calculate buffer size */
}
else
{
- assert( cost );
+ CV_Assert( cost );
val = cost[cost_step*ci + cj];
}
state->cost[i][j] = val;
buffer += dsize;
}
- assert( buffer <= buffer_end );
+ CV_Assert( buffer <= buffer_end );
icvRussel( state );
rv = r0 * std::cos( phi );
i = (int)rv * tn;
i += cvFloor( phi1 );
- assert( i >= 0 );
- assert( i < rn * tn );
+ CV_Assert( i >= 0 );
+ CV_Assert( i < rn * tn );
caccum[i] = (uchar) (caccum[i] + ((i ^ iprev) != 0));
iprev = i;
if( cmax < caccum[i] )
i = CV_IMAX( i, -1 );
i = CV_IMIN( i, sfn );
mcaccum[i]++;
- assert( i >= -1 );
- assert( i <= sfn );
+ CV_Assert( i >= -1 );
+ CV_Assert( i <= sfn );
}
}
}
else
{
- assert( cn == 4 );
+ CV_Assert( cn == 4 );
for( k = 0; k < m*4; k += 4 )
{
UPDATE_ACC01( src_top[k], 0, -- );
double cx = 0, cy = 0;
double mu20, mu11, mu02;
double inv_m00 = 0.0;
- assert( moments != 0 );
+ CV_Assert( moments != 0 );
if( fabs(moments->m00) > DBL_EPSILON )
{
#include "hal_replacement.hpp"
#include <math.h>
-#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
if( sx1 - fsx1 > 1e-3 )
{
- assert( k < ssize*2 );
+ CV_Assert( k < ssize*2 );
tab[k].di = dx * cn;
tab[k].si = (sx1 - 1) * cn;
tab[k++].alpha = (float)((sx1 - fsx1) / cellWidth);
for(int sx = sx1; sx < sx2; sx++ )
{
- assert( k < ssize*2 );
+ CV_Assert( k < ssize*2 );
tab[k].di = dx * cn;
tab[k].si = sx * cn;
tab[k++].alpha = float(1.0 / cellWidth);
if( fsx2 - sx2 > 1e-3 )
{
- assert( k < ssize*2 );
+ CV_Assert( k < ssize*2 );
tab[k].di = dx * cn;
tab[k].si = sx2 * cn;
tab[k++].alpha = (float)(std::min(std::min(fsx2 - sx2, 1.), cellWidth) / cellWidth);
{
if( k == 0 || ytab[k].di != ytab[k-1].di )
{
- assert( ytab[k].di == dy );
+ CV_Assert( ytab[k].di == dy );
tabofs[dy++] = k;
}
}
src += rect.width*pix_size;
rect.width = 0;
}
- assert( rect.width <= win_size.width );
+ CV_Assert( rect.width <= win_size.width );
}
if( ip.y >= 0 )
dr = std::abs((ptr1)[2] - (ptr2)[2]);\
diff = ws_max(db,dg); \
diff = ws_max(diff,dr); \
- assert( 0 <= diff && diff <= 255 ); \
+ CV_Assert( 0 <= diff && diff <= 255 ); \
}
CV_Assert( src.type() == CV_8UC3 && dst.type() == CV_32SC1 );
}
// Add to according queue
- assert( 0 <= idx && idx <= 255 );
+ CV_Assert( 0 <= idx && idx <= 255 );
ws_push( idx, i*mstep + j, i*istep + j*3 );
m[0] = IN_QUEUE;
}
}
// Set label to current pixel in marker image
- assert( lab != 0 );
+ CV_Assert( lab != 0 );
m[0] = lab;
if( lab == WSHED )
else
CV_Error_(CV_StsError, ("Subdiv2D::locate returned invalid location = %d", location) );
- assert( curr_edge != 0 );
+ CV_Assert( curr_edge != 0 );
validGeometry = false;
curr_point = newPoint(pt, false);
////////////////////////////////
if( SrcReader == NULL )
{
- assert( false );
+ CV_Assert( false );
return 0;
}
int Count;
int i,j;
- assert( SrcSeq && DstSeq );
+ CV_Assert( SrcSeq && DstSeq );
////////// init ////////////////////
Count = SrcSeq->total;
}
else
{
- assert( cn == 3 );
+ CV_Assert( cn == 3 );
for( j = 0; j < size.width*3; j += 3 )
{
float sum_b = 0, sum_g = 0, sum_r = 0, wsum = 0;
}
else
{
- assert( fabs(tg) > tan_3pi_8 );
+ CV_Assert( fabs(tg) > tan_3pi_8 );
x1 = x2 = x; y1 = y + 1; y2 = y - 1;
}
float* dst_buf = &_dst_buf[0];
int i, j;
- assert( (cn == 3 || cn == 4) && (dst_cn == 3 || dst_cn == 1) );
+ CV_Assert( (cn == 3 || cn == 4) && (dst_cn == 3 || dst_cn == 1) );
for( i = 0; i < src.rows; i++ )
{
}
break;
default:
- assert(0);
+ CV_Assert(0);
}
}
}
float* dst_buf = &_dst_buf[0];
int i, j;
- assert( cn == 3 || cn == 4 );
+ CV_Assert( cn == 3 || cn == 4 );
for( i = 0; i < src.rows; i++ )
{
}
break;
default:
- assert(0);
+ CV_Assert(0);
}
}
}
}
break;
default:
- assert(0);
+ CV_Assert(0);
}
}
}
}
break;
default:
- assert(0);
+ CV_Assert(0);
}
}
}
int i, j;
int step = img->widthStep;
- assert( img->depth == IPL_DEPTH_8U && img->nChannels == 1 && (val&1) != 0);
+ CV_Assert( img->depth == IPL_DEPTH_8U && img->nChannels == 1 && (val&1) != 0);
for( i = 1; i < img->height - 1; i++ )
for( j = 1; j < img->width - 1; j++ )
else
{
CvMat* ptm = (CvMat*)pointsSet;
- assert( CV_IS_MAT(ptm) && CV_IS_MAT_CONT(ptm->type) );
+ CV_Assert( CV_IS_MAT(ptm) && CV_IS_MAT_CONT(ptm->type) );
total = ptm->rows + ptm->cols - 1;
point_type = CV_MAT_TYPE(ptm->type);
data = ptm->data.ptr;
n = CV_MAT_CN(point_type);
point_type = CV_MAT_DEPTH(point_type);
- assert( (point_type == CV_32S || point_type == CV_32F) && n <= 4 );
+ CV_Assert( (point_type == CV_32S || point_type == CV_32F) && n <= 4 );
for( i = 0; i < total; i++ )
{
else
{
CvMat* ptm = (CvMat*)pointsSet;
- assert( CV_IS_MAT(ptm) && CV_IS_MAT_CONT(ptm->type) );
+ CV_Assert( CV_IS_MAT(ptm) && CV_IS_MAT_CONT(ptm->type) );
total = ptm->rows + ptm->cols - 1;
point_type = CV_MAT_TYPE(ptm->type);
data = ptm->data.ptr;
else
{
CvMat* ptm = (CvMat*)pointsSet;
- assert( CV_IS_MAT(ptm) && CV_IS_MAT_CONT(ptm->type) );
+ CV_Assert( CV_IS_MAT(ptm) && CV_IS_MAT_CONT(ptm->type) );
total = ptm->rows + ptm->cols - 1;
point_type = CV_MAT_DEPTH(CV_MAT_TYPE(ptm->type));
data = ptm->data.ptr;
else
{
CvMat* ptm = (CvMat*)points;
- assert( CV_IS_MAT(ptm) && CV_IS_MAT_CONT(ptm->type) );
+ CV_Assert( CV_IS_MAT(ptm) && CV_IS_MAT_CONT(ptm->type) );
total = ptm->rows + ptm->cols - 1;
point_type = CV_MAT_TYPE(ptm->type);
data = ptm->data.ptr;
}
- assert( point_type == CV_32SC2 || point_type == CV_32FC2 );
+ CV_Assert( point_type == CV_32SC2 || point_type == CV_32FC2 );
for( i = 0; i < total; i++ )
{
center.x = (float)(img_size.width*0.5 + (cvtest::randReal(rng)-0.5)*(img_size.width - max_sz*2)*0.8);
center.y = (float)(img_size.height*0.5 + (cvtest::randReal(rng)-0.5)*(img_size.height - max_sz*2)*0.8);
- assert( 0 < center.x - max_sz && center.x + max_sz < img_size.width &&
- 0 < center.y - max_sz && center.y + max_sz < img_size.height );
+ CV_Assert( 0 < center.x - max_sz && center.x + max_sz < img_size.width &&
+ 0 < center.y - max_sz && center.y + max_sz < img_size.height );
max_r_scale = cvtest::randReal(rng)*max_max_r_scale*0.01;
angle = cvtest::randReal(rng)*360;
float delta[16];
int tstep, count;
- assert( mask_size == 3 || mask_size == 5 );
+ CV_Assert( mask_size == 3 || mask_size == 5 );
if( dist_type == CV_DIST_USER )
memcpy( mask, _mask, sizeof(mask) );
median_pair *buf0 = &_buf0[0], *buf1 = &_buf1[0];
int step = (int)(src.step/src.elemSize());
- assert( src.rows == dst.rows + m - 1 && src.cols == dst.cols + m - 1 &&
- src.type() == dst.type() && src.type() == CV_8UC1 );
+ CV_Assert( src.rows == dst.rows + m - 1 && src.cols == dst.cols + m - 1 &&
+ src.type() == dst.type() && src.type() == CV_8UC1 );
for( i = 0; i < dst.rows; i++ )
{
*buf1++ = buf0[k++];
else
{
- assert( col_buf[l] < INT_MAX );
+ CV_Assert( col_buf[l] < INT_MAX );
*buf1++ = median_pair(ins_col,col_buf[l++]);
}
}
if( del_col < 0 )
n += m;
buf1 -= n;
- assert( n == m2 );
+ CV_Assert( n == m2 );
dst1[j] = (uchar)buf1[n/2].val;
median_pair* tbuf;
CV_SWAP( buf0, buf1, tbuf );
}
break;
default:
- assert(0);
+ CV_Assert(0);
}
/*switch( depth )
}
break;
default:
- assert(0);
+ CV_Assert(0);
}
}
}
else if (interpolation == INTER_LANCZOS4)
ksize = 8;
else if (interpolation != INTER_LINEAR)
- assert(0);
+ CV_Assert(0);
int ofs = (ksize / 2) - 1;
CV_Assert(_src.depth() == CV_32F && _dst.type() == _src.type());
b_denom = 1.;
}
- assert( CV_TM_SQDIFF <= method && method <= CV_TM_CCOEFF_NORMED );
+ CV_Assert( CV_TM_SQDIFF <= method && method <= CV_TM_CCOEFF_NORMED );
for( i = 0; i < result->rows; i++ )
{
imaxval = cvRound(maxval);
}
- assert( depth == CV_8U || depth == CV_16S || depth == CV_16U || depth == CV_32F || depth == CV_64F );
+ CV_Assert( depth == CV_8U || depth == CV_16S || depth == CV_16U || depth == CV_32F || depth == CV_64F );
switch( thresh_type )
{
}
break;
default:
- assert(0);
+ CV_Assert(0);
}
}
#include "opencv2/core/private.hpp"
-#include <assert.h>
#include <float.h>
#include <limits.h>
#include <math.h>
}
else
{
- assert( m == 2 );
+ CV_Assert( m == 2 );
dbl_ptr = (double**)(c_weights + _mi);
for( j = 0; j < mi; j++ )
dbl_ptr[j] = cjk + j*2 + 1;
{
CV_INSTRUMENT_REGION();
- assert( !oldCascade &&
- (data.featureType == FeatureEvaluator::HAAR ||
- data.featureType == FeatureEvaluator::LBP ||
- data.featureType == FeatureEvaluator::HOG) );
+ CV_Assert( !oldCascade &&
+ (data.featureType == FeatureEvaluator::HAAR ||
+ data.featureType == FeatureEvaluator::LBP ||
+ data.featureType == FeatureEvaluator::HOG) );
if( !evaluator->setWindow(pt, scaleIdx) )
return -1;
//M*/
#include "precomp.hpp"
-#include <cassert>
#ifdef CV_CXX11
#define USE_STD_THREADS
}
cascade->hid_cascade = out;
- assert( (char*)haar_node_ptr - (char*)out <= datasize );
+ CV_Assert( (char*)haar_node_ptr - (char*)out <= datasize );
return out;
}
if( cascade->is_tree )
{
CvHidHaarStageClassifier* ptr = cascade->stage_classifier;
- assert( start_stage == 0 );
+ CV_Assert( start_stage == 0 );
while( ptr )
{
data->gradWeight = weights(i,j);
}
- assert( count1 + count2 + count4 == rawBlockSize );
+ CV_Assert( count1 + count2 + count4 == rawBlockSize );
// defragment pixData
for( j = 0; j < count2; j++ )
pixData[j + count1] = pixData[j + rawBlockSize];
const float* HOGCache::getBlock(Point pt, float* buf)
{
float* blockHist = buf;
- assert(descriptor != 0);
+ CV_Assert(descriptor != 0);
// Size blockSize = descriptor->blockSize;
pt += imgoffset;
// write detectors
validationFS << DETECTORS << "{";
- assert( detectorNames.size() == detectorFilenames.size() );
+ CV_Assert( detectorNames.size() == detectorFilenames.size() );
nit = detectorNames.begin();
for( int di = 0; nit != detectorNames.end(); ++nit, di++ )
{
int CV_DetectorTest::validate( int detectorIdx, vector<vector<Rect> >& objects )
{
- assert( imageFilenames.size() == objects.size() );
+ CV_Assert( imageFilenames.size() == objects.size() );
int imageIdx = 0;
int totalNoPair = 0, totalValRectCount = 0;
if( detectorFilenames[di].empty() )
hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());
else
- assert(0);
+ CV_Assert(0);
hog.detectMultiScale(img, objects);
return cvtest::TS::OK;
}
data->gradWeight = weights(i,j);
}
- assert( count1 + count2 + count4 == rawBlockSize );
+ CV_Assert( count1 + count2 + count4 == rawBlockSize );
// defragment pixData
for( j = 0; j < count2; j++ )
pixData[j + count1] = pixData[j + rawBlockSize];
const float* HOGCacheTester::getBlock(Point pt, float* buf)
{
float* blockHist = buf;
- assert(descriptor != 0);
+ CV_Assert(descriptor != 0);
Size blockSize = descriptor->blockSize;
pt += imgoffset;
hidx += _nbins;
else if( hidx >= _nbins )
hidx -= _nbins;
- assert( (unsigned)hidx < (unsigned)_nbins );
+ CV_Assert( (unsigned)hidx < (unsigned)_nbins );
qanglePtr[x*2] = (uchar)hidx;
hidx++;
void checkDeviceMaxMemoryAllocSize(const Size& size, int type, int factor)
{
- assert(factor > 0);
+ CV_Assert(factor > 0);
if (!cv::ocl::useOpenCL())
return;
void BaseTest::run_func(void)
{
- assert(0);
+ CV_Assert(0);
}
double ArrayTest::get_success_error_level( int /*test_case_idx*/, int i, int j )
{
int elem_depth = CV_MAT_DEPTH(cvGetElemType(test_array[i][j]));
- assert( i == OUTPUT || i == INPUT_OUTPUT );
+ CV_Assert( i == OUTPUT || i == INPUT_OUTPUT );
return elem_depth < CV_32F ? 0 : elem_depth == CV_32F ? FLT_EPSILON*100: DBL_EPSILON*5000;
}
void ArrayTest::prepare_to_validation( int /*test_case_idx*/ )
{
- assert(0);
+ CV_Assert(0);
}
int i1 = i == 0 ? REF_OUTPUT : REF_INPUT_OUTPUT;
size_t sizei = test_array[i0].size();
- assert( sizei == test_array[i1].size() );
+ CV_Assert( sizei == test_array[i1].size() );
for( j = 0; j < sizei; j++ )
{
double err_level;
}
break;
default:
- assert(0);
+ CV_Assert(0);
return CMP_EPS_BIG_DIFF;
}
if(_realmaxdiff)
if( _aperture_size < 0 )
{
static const int scharr[8] = { 3, 10, 3, -1, 0, 1, 0, 0 }; // extra elements to eliminate "-Warray-bounds" bogus warning
- assert( size == 3 );
+ CV_Assert( size == 3 && order < 2 );
for( i = 0; i < size; i++ )
kernel[i] = scharr[order*3 + i];
return;
imaxval = cvRound(maxval);
}
- assert( depth == CV_8U || depth == CV_16S || depth == CV_32F );
+ CV_Assert( depth == CV_8U || depth == CV_16S || depth == CV_32F );
switch( thresh_type )
{
}
break;
default:
- assert(0);
+ CV_Assert(0);
}
}
bool has_next = false;
do {
- assert(currentIter == times.size());
+ CV_Assert(currentIter == times.size());
if (currentIter == 0)
{
has_next = true;
}
else
{
- assert(getCurrentPerformanceStrategy() == PERF_STRATEGY_SIMPLE);
+ CV_Assert(getCurrentPerformanceStrategy() == PERF_STRATEGY_SIMPLE);
if (totalTime - lastActivityPrintTime >= cv::getTickFrequency() * 10)
{
std::cout << '.' << std::endl;
}
else
{
- assert(false);
+ CV_Assert(false);
}
int offset = static_cast<int>(start - times.begin());
}
else
{
- assert(false);
+ CV_Assert(false);
}
}
// TODO
if( format==7 ) {
- assert(0);
+ CV_Assert(0);
return 1;
}
// irrelvant to depth
int mode = cmucam->GetVideoMode();
if( format==7 ){
- assert(0);
+ CV_Assert(0);
return 1;
}
format_idx = preferred_modes[i] - FORMAT_MIN;
continue;
}
- assert(format_idx != -1);
+ CV_Assert(format_idx != -1);
if ( ! icvFormatSupportedCAM_DC1394(pcap->format, formats) )
continue;
if ( icvModeSupportedCAM_DC1394(pcap->format, preferred_modes[i], modes[format_idx]) ){
uint32_t value = 0;
dc1394error_t err = dc1394_get_control_register(camera, offset, &value);
- assert(err == DC1394_SUCCESS);
return err == DC1394_SUCCESS ? value : 0xffffffff;
}
#if !(defined(_WIN32) || defined(WINCE))
# include <pthread.h>
#endif
-#include <assert.h>
#include <algorithm>
#include <limits>
inline int _opencv_ffmpeg_interrupt_callback(void *ptr)
{
AVInterruptCallbackMetadata* metadata = (AVInterruptCallbackMetadata*)ptr;
- assert(metadata);
+ CV_Assert(metadata);
if (metadata->timeout_after_ms == 0)
{
}
}
else {
- assert(false);
+ CV_Assert(false);
}
if( (width & -2) != frame_width || (height & -2) != frame_height || !data )
}
if ( c->pix_fmt != input_pix_fmt ) {
- assert( input_picture );
+ CV_Assert( input_picture );
// let input_picture point to the raw data buffer of 'image'
_opencv_ffmpeg_av_image_fill_arrays(input_picture, (uint8_t *) data,
(AVPixelFormat)input_pix_fmt, width, height);
#else
oc = av_alloc_format_context();
#endif
- assert (oc);
+ CV_Assert (oc);
/* set file name */
oc->oformat = fmt;
{
gige::IImageInfo imageInfo;
m_device->GetImageInfo (&imageInfo);
- assert(imageInfo.IsValid());
+ CV_Assert(imageInfo.IsValid());
if (m_device->GetPendingImagesCount() == 1)
{
#include <string.h>
#include <stdlib.h>
#include <asm/types.h> /* for videodev2.h */
-#include <assert.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
}
}
- assert(buf.index < capture->req.count);
+ CV_Assert(buf.index < capture->req.count);
#ifdef USE_TEMP_BUFFER
memcpy(capture->buffers[MAX_V4L_BUFFERS].start,
// standard includes
#include <cstdio>
-#include <cassert>
// Mac OS includes
#include <Carbon/Carbon.h>
/// capture properties currently unimplemented for QuickTime camera interface
static double icvGetProperty_QT_Cam (CvCapture_QT_Cam * capture, int property_id)
{
- assert (0);
+ CV_Assert (0);
return 0;
}
/// capture properties currently unimplemented for QuickTime camera interface
static int icvSetProperty_QT_Cam (CvCapture_QT_Cam * capture, int property_id, double value)
{
- assert (0);
+ CV_Assert (0);
return 0;
}
#include <string.h>
#include <stdlib.h>
-#include <assert.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <limits>
return false;
}
- assert(buf.index < req.count);
- assert(buffers[buf.index].length == buf.length);
+ CV_Assert(buf.index < req.count);
+ CV_Assert(buffers[buf.index].length == buf.length);
//We shouldn't use this buffer in the queue while not retrieve frame from it.
buffers[buf.index].buffer = buf;
#include <string.h>
#include <limits.h>
#include <ctype.h>
-#include <assert.h> // FIXIT remove this
#if defined _WIN32 || defined WINCE
#if !defined _WIN32_WINNT