mirror of
https://github.com/opencv/opencv.git
synced 2026-09-12 21:37:09 -05:00
Merge pull request #21107 from take1014:remove_assert_21038
resolves #21038 * remove C assert * revert C header * fix several points in review * fix test_ds.cpp
This commit is contained in:
@@ -182,7 +182,7 @@ int CV_ApproxPolyTest::check_slice( CvPoint StartPt, CvPoint EndPt,
|
||||
////////////////////////////////
|
||||
if( SrcReader == NULL )
|
||||
{
|
||||
assert( false );
|
||||
CV_Assert( false );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ int CV_ApproxPolyTest::check( CvSeq* SrcSeq, CvSeq* DstSeq, float Eps )
|
||||
int Count;
|
||||
int i,j;
|
||||
|
||||
assert( SrcSeq && DstSeq );
|
||||
CV_Assert( SrcSeq && DstSeq );
|
||||
|
||||
////////// init ////////////////////
|
||||
Count = SrcSeq->total;
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace opencv_test { namespace {
|
||||
}
|
||||
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;
|
||||
|
||||
@@ -249,7 +249,7 @@ test_Canny( const Mat& src, Mat& dst,
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( fabs(tg) > tan_3pi_8 );
|
||||
CV_Assert( fabs(tg) > tan_3pi_8 );
|
||||
x1 = x2 = x; y1 = y + 1; y2 = y - 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ void CV_ColorCvtBaseTest::convert_forward( const Mat& src, Mat& dst )
|
||||
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++ )
|
||||
{
|
||||
@@ -281,7 +281,7 @@ void CV_ColorCvtBaseTest::convert_forward( const Mat& src, Mat& dst )
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
CV_Assert(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -312,7 +312,7 @@ void CV_ColorCvtBaseTest::convert_backward( const Mat& src, const Mat& dst, Mat&
|
||||
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++ )
|
||||
{
|
||||
@@ -385,7 +385,7 @@ void CV_ColorCvtBaseTest::convert_backward( const Mat& src, const Mat& dst, Mat&
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
CV_Assert(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1571,7 +1571,7 @@ void CV_ColorRGBTest::convert_forward( const Mat& src, Mat& dst )
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
CV_Assert(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1677,7 +1677,7 @@ void CV_ColorRGBTest::convert_backward( const Mat& /*src*/, const Mat& src, Mat&
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
CV_Assert(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ cvTsMarkContours( IplImage* img, int val )
|
||||
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++ )
|
||||
|
||||
@@ -301,7 +301,7 @@ void CV_BaseShapeDescrTest::generate_point_set( void* pointsSet )
|
||||
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;
|
||||
@@ -310,7 +310,7 @@ void CV_BaseShapeDescrTest::generate_point_set( void* pointsSet )
|
||||
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++ )
|
||||
{
|
||||
@@ -1335,7 +1335,7 @@ void CV_FitEllipseTest::generate_point_set( void* pointsSet )
|
||||
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;
|
||||
@@ -1621,7 +1621,7 @@ void CV_FitLineTest::generate_point_set( void* pointsSet )
|
||||
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;
|
||||
@@ -1788,13 +1788,13 @@ cvTsGenerateTousledBlob( CvPoint2D32f center, CvSize2D32f axes,
|
||||
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++ )
|
||||
{
|
||||
@@ -1874,8 +1874,8 @@ void CV_ContourMomentsTest::generate_point_set( void* pointsSet )
|
||||
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;
|
||||
|
||||
@@ -161,7 +161,7 @@ cvTsDistTransform( const CvMat* _src, CvMat* _dst, int dist_type,
|
||||
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) );
|
||||
|
||||
@@ -992,8 +992,8 @@ static void test_medianFilter( const Mat& src, Mat& dst, int m )
|
||||
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++ )
|
||||
{
|
||||
@@ -1050,7 +1050,7 @@ static void test_medianFilter( const Mat& src, Mat& dst, int m )
|
||||
*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++]);
|
||||
}
|
||||
}
|
||||
@@ -1061,7 +1061,7 @@ static void test_medianFilter( const Mat& src, Mat& dst, int m )
|
||||
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 );
|
||||
|
||||
@@ -169,7 +169,7 @@ int CV_ImgWarpBaseTest::prepare_test_case( int test_case_idx )
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
CV_Assert(0);
|
||||
}
|
||||
|
||||
/*switch( depth )
|
||||
@@ -482,7 +482,7 @@ static void test_remap( const Mat& src, Mat& dst, const Mat& mapx, const Mat& ma
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
CV_Assert(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -935,7 +935,7 @@ void CV_Remap_Test::remap_generic(const Mat& _src, Mat& _dst)
|
||||
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());
|
||||
|
||||
@@ -185,7 +185,7 @@ static void cvTsMatchTemplate( const CvMat* img, const CvMat* templ, CvMat* resu
|
||||
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++ )
|
||||
{
|
||||
|
||||
@@ -157,7 +157,7 @@ static void test_threshold( const Mat& _src, Mat& _dst,
|
||||
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 )
|
||||
{
|
||||
@@ -407,7 +407,7 @@ static void test_threshold( const Mat& _src, Mat& _dst,
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
CV_Assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user