Skip to content

Commit c455fc0

Browse files
committed
Merge pull request opencv#9133 from sovrasov:mser_add_test
2 parents 42c0914 + 25af743 commit c455fc0

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

modules/features2d/test/test_mser.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,26 @@ TEST(Features2d_MSER, cases)
159159
ASSERT_GE(maxRegs, nmsers);
160160
}
161161
}
162+
163+
TEST(Features2d_MSER, history_update_regression)
164+
{
165+
String dataPath = cvtest::TS::ptr()->get_data_path() + "mser/";
166+
vector<Mat> tstImages;
167+
tstImages.push_back(imread(dataPath + "mser_test.png", IMREAD_GRAYSCALE));
168+
tstImages.push_back(imread(dataPath + "mser_test2.png", IMREAD_GRAYSCALE));
169+
170+
for(size_t j = 0; j < tstImages.size(); j++)
171+
{
172+
size_t previous_size = 0;
173+
for(int minArea = 100; minArea > 10; minArea--)
174+
{
175+
Ptr<MSER> mser = MSER::create(1, minArea, (int)(tstImages[j].cols * tstImages[j].rows * 0.2));
176+
mser->setPass2Only(true);
177+
vector<vector<Point> > mserContours;
178+
vector<Rect> boxRects;
179+
mser->detectRegions(tstImages[j], mserContours, boxRects);
180+
ASSERT_LE(previous_size, mserContours.size());
181+
previous_size = mserContours.size();
182+
}
183+
}
184+
}

0 commit comments

Comments
 (0)