@ -1847,13 +1847,54 @@ INSTANTIATE_TEST_CASE_P(Arithm, SubtractOutputMatNotEmpty, testing::Combine(
testing : : Values ( - 1 , CV_16S , CV_32S , CV_32F ) ,
testing : : Values ( - 1 , CV_16S , CV_32S , CV_32F ) ,
testing : : Bool ( ) ) ) ;
testing : : Bool ( ) ) ) ;
TEST ( Core_FindNonZero , singular )
TEST ( Core_FindNonZero , regres sio n)
{
{
Mat img ( 10 , 10 , CV_8U , Scalar : : all ( 0 ) ) ;
Mat img ( 10 , 10 , CV_8U , Scalar : : all ( 0 ) ) ;
vector < Point > pts , pts2 ( 10 ) ;
vector < Point > pts , pts2 ( 5 ) ;
findNonZero ( img , pts ) ;
findNonZero ( img , pts ) ;
findNonZero ( img , pts2 ) ;
findNonZero ( img , pts2 ) ;
ASSERT_TRUE ( pts . empty ( ) & & pts2 . empty ( ) ) ;
ASSERT_TRUE ( pts . empty ( ) & & pts2 . empty ( ) ) ;
RNG rng ( ( uint64 ) - 1 ) ;
size_t nz = 0 ;
for ( int i = 0 ; i < 10 ; i + + )
{
int idx = rng . uniform ( 0 , img . rows * img . cols ) ;
if ( ! img . data [ idx ] ) nz + + ;
img . data [ idx ] = ( uchar ) rng . uniform ( 1 , 256 ) ;
}
findNonZero ( img , pts ) ;
ASSERT_TRUE ( pts . size ( ) = = nz ) ;
img . convertTo ( img , CV_8S ) ;
pts . clear ( ) ;
findNonZero ( img , pts ) ;
ASSERT_TRUE ( pts . size ( ) = = nz ) ;
img . convertTo ( img , CV_16U ) ;
pts . resize ( pts . size ( ) * 2 ) ;
findNonZero ( img , pts ) ;
ASSERT_TRUE ( pts . size ( ) = = nz ) ;
img . convertTo ( img , CV_16S ) ;
pts . resize ( pts . size ( ) * 3 ) ;
findNonZero ( img , pts ) ;
ASSERT_TRUE ( pts . size ( ) = = nz ) ;
img . convertTo ( img , CV_32S ) ;
pts . resize ( pts . size ( ) * 4 ) ;
findNonZero ( img , pts ) ;
ASSERT_TRUE ( pts . size ( ) = = nz ) ;
img . convertTo ( img , CV_32F ) ;
pts . resize ( pts . size ( ) * 5 ) ;
findNonZero ( img , pts ) ;
ASSERT_TRUE ( pts . size ( ) = = nz ) ;
img . convertTo ( img , CV_64F ) ;
pts . clear ( ) ;
findNonZero ( img , pts ) ;
ASSERT_TRUE ( pts . size ( ) = = nz ) ;
}
}
TEST ( Core_BoolVector , support )
TEST ( Core_BoolVector , support )