Skip to content

Commit 39e448f

Browse files
committed
Merge pull request opencv#13347 from alalek:kw_resize_check
2 parents a0fed8d + 2d5ccc7 commit 39e448f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

modules/imgproc/src/resize.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3782,9 +3782,9 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize,
37823782
Size ssize = _src.size();
37833783

37843784
CV_Assert( !ssize.empty() );
3785-
CV_Assert( !dsize.empty() || (inv_scale_x > 0 && inv_scale_y > 0) );
37863785
if( dsize.empty() )
37873786
{
3787+
CV_Assert(inv_scale_x > 0); CV_Assert(inv_scale_y > 0);
37883788
dsize = Size(saturate_cast<int>(ssize.width*inv_scale_x),
37893789
saturate_cast<int>(ssize.height*inv_scale_y));
37903790
CV_Assert( !dsize.empty() );
@@ -3793,6 +3793,7 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize,
37933793
{
37943794
inv_scale_x = (double)dsize.width/ssize.width;
37953795
inv_scale_y = (double)dsize.height/ssize.height;
3796+
CV_Assert(inv_scale_x > 0); CV_Assert(inv_scale_y > 0);
37963797
}
37973798

37983799
if (interpolation == INTER_LINEAR_EXACT && (_src.depth() == CV_32F || _src.depth() == CV_64F))

0 commit comments

Comments
 (0)