mirror of
https://github.com/opencv/opencv.git
synced 2025-06-11 03:33:28 +08:00
Merge pull request #12443 from DEEPIR:master
* simplify condition * dims must > 0 or latter sz[dims-1] will underflow
This commit is contained in:
parent
f1f15841d7
commit
8b48c2a10c
@ -617,7 +617,7 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
|
|||||||
if( (kind1 == kind2 || cn == 1) && sz1 == sz2 && dims1 <= 2 && dims2 <= 2 && type1 == type2 &&
|
if( (kind1 == kind2 || cn == 1) && sz1 == sz2 && dims1 <= 2 && dims2 <= 2 && type1 == type2 &&
|
||||||
!haveMask && ((!_dst.fixedType() && (dtype < 0 || CV_MAT_DEPTH(dtype) == depth1)) ||
|
!haveMask && ((!_dst.fixedType() && (dtype < 0 || CV_MAT_DEPTH(dtype) == depth1)) ||
|
||||||
(_dst.fixedType() && _dst.type() == type1)) &&
|
(_dst.fixedType() && _dst.type() == type1)) &&
|
||||||
((src1Scalar && src2Scalar) || (!src1Scalar && !src2Scalar)) )
|
(src1Scalar == src2Scalar) )
|
||||||
{
|
{
|
||||||
_dst.createSameSize(*psrc1, type1);
|
_dst.createSameSize(*psrc1, type1);
|
||||||
CV_OCL_RUN(use_opencl,
|
CV_OCL_RUN(use_opencl,
|
||||||
@ -1257,7 +1257,7 @@ void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op)
|
|||||||
compare(_src2, _src1, _dst, op);
|
compare(_src2, _src1, _dst, op);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if( (is_src1_scalar && is_src2_scalar) || (!is_src1_scalar && !is_src2_scalar) )
|
else if(is_src1_scalar == is_src2_scalar)
|
||||||
CV_Error( CV_StsUnmatchedSizes,
|
CV_Error( CV_StsUnmatchedSizes,
|
||||||
"The operation is neither 'array op array' (where arrays have the same size and the same type), "
|
"The operation is neither 'array op array' (where arrays have the same size and the same type), "
|
||||||
"nor 'array op scalar', nor 'scalar op array'" );
|
"nor 'array op scalar', nor 'scalar op array'" );
|
||||||
|
@ -258,7 +258,7 @@ void Mat::copyTo( OutputArray _dst ) const
|
|||||||
UMat dst = _dst.getUMat();
|
UMat dst = _dst.getUMat();
|
||||||
CV_Assert(dst.u != NULL);
|
CV_Assert(dst.u != NULL);
|
||||||
size_t i, sz[CV_MAX_DIM] = {0}, dstofs[CV_MAX_DIM], esz = elemSize();
|
size_t i, sz[CV_MAX_DIM] = {0}, dstofs[CV_MAX_DIM], esz = elemSize();
|
||||||
CV_Assert(dims >= 0 && dims < CV_MAX_DIM);
|
CV_Assert(dims > 0 && dims < CV_MAX_DIM);
|
||||||
for( i = 0; i < (size_t)dims; i++ )
|
for( i = 0; i < (size_t)dims; i++ )
|
||||||
sz[i] = size.p[i];
|
sz[i] = size.p[i];
|
||||||
sz[dims-1] *= esz;
|
sz[dims-1] *= esz;
|
||||||
|
Loading…
Reference in New Issue
Block a user