added test for http://code.opencv.org/issues/2736
This commit is contained in:
parent
71002e0e79
commit
d3b0cb878a
@ -1918,3 +1918,37 @@ TEST(Imgproc_Blur, borderTypes)
|
||||
EXPECT_EQ(expected_dst.size(), dst.size());
|
||||
EXPECT_DOUBLE_EQ(0.0, cvtest::norm(expected_dst, dst, NORM_INF));
|
||||
}
|
||||
|
||||
TEST(Imgproc_Morphology, iterated)
|
||||
{
|
||||
RNG& rng = theRNG();
|
||||
for( int iter = 0; iter < 30; iter++ )
|
||||
{
|
||||
int width = rng.uniform(5, 33);
|
||||
int height = rng.uniform(5, 33);
|
||||
int cn = rng.uniform(1, 5);
|
||||
int iterations = rng.uniform(1, 11);
|
||||
int op = rng.uniform(0, 2);
|
||||
Mat src(height, width, CV_8UC(cn)), dst0, dst1, dst2;
|
||||
|
||||
randu(src, 0, 256);
|
||||
if( op == 0 )
|
||||
dilate(src, dst0, Mat(), Point(-1,-1), iterations);
|
||||
else
|
||||
erode(src, dst0, Mat(), Point(-1,-1), iterations);
|
||||
|
||||
for( int i = 0; i < iterations; i++ )
|
||||
if( op == 0 )
|
||||
dilate(i == 0 ? src : dst1, dst1, Mat(), Point(-1,-1), 1);
|
||||
else
|
||||
erode(i == 0 ? src : dst1, dst1, Mat(), Point(-1,-1), 1);
|
||||
|
||||
Mat kern = getStructuringElement(MORPH_RECT, Size(3,3));
|
||||
if( op == 0 )
|
||||
dilate(src, dst2, kern, Point(-1,-1), iterations);
|
||||
else
|
||||
erode(src, dst2, kern, Point(-1,-1), iterations);
|
||||
ASSERT_EQ(0.0, norm(dst0, dst1, NORM_INF));
|
||||
ASSERT_EQ(0.0, norm(dst0, dst2, NORM_INF));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user