Merge pull request #15937 from clunietp:3.4-fix-13577

This commit is contained in:
Alexander Alekhin 2019-11-18 18:23:48 +00:00
commit fb9d59ab15
2 changed files with 17 additions and 0 deletions

View File

@ -1383,4 +1383,16 @@ TEST(UMat, testTempObjects_Mat_issue_8693)
EXPECT_EQ(0, cvtest::norm(srcUMat.getMat(ACCESS_READ), srcMat, NORM_INF));
}
TEST(UMat, resize_Mat_issue_13577)
{
// save the current state
bool useOCL = cv::ocl::useOpenCL();
cv::ocl::setUseOpenCL(false);
UMat foo(10, 10, CV_32FC1);
cv::resize(foo, foo, cv::Size(), .5, .5);
cv::ocl::setUseOpenCL(useOCL); // restore state
}
} } // namespace opencv_test::ocl

View File

@ -3738,6 +3738,11 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize,
CV_OCL_RUN(_src.dims() <= 2 && _dst.isUMat() && _src.cols() > 10 && _src.rows() > 10,
ocl_resize(_src, _dst, dsize, inv_scale_x, inv_scale_y, interpolation))
// Fake reference to source. Resolves issue 13577 in case of src == dst.
UMat srcUMat;
if (_src.isUMat())
srcUMat = _src.getUMat();
Mat src = _src.getMat();
_dst.create(dsize, src.type());
Mat dst = _dst.getMat();