1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Merge pull request #11706 from take1014:setTo_Nan_10507

* setTo_#10507

* setTo_Nan_10507

* setTo: update check / test for NaNs
This commit is contained in:
yuki takehara
2018-06-13 03:05:44 +09:00
committed by Alexander Alekhin
parent ff3d4d8b7f
commit 4fe648b15c
2 changed files with 32 additions and 1 deletions
+6 -1
View File
@@ -463,9 +463,14 @@ static bool ipp_Mat_setTo_Mat(Mat &dst, Mat &_val, Mat &mask)
return false;
if (dst.depth() == CV_32F)
{
for (int i = 0; i < (int)(_val.total()); i++)
if (_val.at<double>(i) < iwTypeGetMin(ipp32f) || _val.at<double>(i) > iwTypeGetMax(ipp32f))
{
float v = (float)(_val.at<double>(i)); // cast to float
if (cvIsNaN(v) || cvIsInf(v)) // accept finite numbers only
return false;
}
}
if(dst.dims <= 2)
{