TEST(Imgproc_Threshold,huge)/* since the test needs a lot of memory, enable it only on 64-bit Intel/AMD platforms, otherwise it may take a lot of time because of heavy swapping */
#else
TEST(DISABLED_Imgproc_Threshold,huge)
#endif
BIGDATA_TEST(Imgproc_Threshold,huge)
{
Matm;
try
{
m.create(65000,40000,CV_8U);
}
catch(...)
{
}
Matm(65000,40000,CV_8U);
ASSERT_FALSE(m.isContinuous());
if(!m.empty())
{
ASSERT_FALSE(m.isContinuous());
uint64i,n=(uint64)m.rows*m.cols;
for(i=0;i<n;i++)
m.data[i]=(uchar)(i&255);
uint64i,n=(uint64)m.rows*m.cols;
for(i=0;i<n;i++)
m.data[i]=(uchar)(i&255);
cv::threshold(m,m,127,255,cv::THRESH_BINARY);
intnz=cv::countNonZero(m);
ASSERT_EQ(nz,(int)(n/2));
}
// just skip the test if there is no enough memory
cv::threshold(m,m,127,255,cv::THRESH_BINARY);
intnz=cv::countNonZero(m);// FIXIT 'int' is not enough here (overflow is possible with other inputs)