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)
{
ASSERT_EQ(2, sub_mat.size[2]);
}
+TEST(Mat, regression_10507_mat_setTo)
+{
+ Size sz(6, 4);
+ Mat test_mask(sz, CV_8UC1, cv::Scalar::all(255));
+ test_mask.at<uchar>(1,0) = 0;
+ test_mask.at<uchar>(0,1) = 0;
+ for (int cn = 1; cn <= 4; cn++)
+ {
+ cv::Mat A(sz, CV_MAKE_TYPE(CV_32F, cn), cv::Scalar::all(5));
+ A.setTo(cv::Scalar::all(std::numeric_limits<float>::quiet_NaN()), test_mask);
+ int nans = 0;
+ for (int y = 0; y < A.rows; y++)
+ {
+ for (int x = 0; x < A.cols; x++)
+ {
+ for (int c = 0; c < cn; c++)
+ {
+ float v = A.ptr<float>(y, x)[c];
+ nans += (v == v) ? 0 : 1;
+ }
+ }
+ }
+ EXPECT_EQ(nans, cn * (sz.area() - 2)) << "A=" << A << std::endl << "mask=" << test_mask << std::endl;
+ }
+}
+
#ifdef CV_CXX_STD_ARRAY
TEST(Core_Mat_array, outputArray_create_getMat)
{