features2d: fix ORB::setFirstScale() handling

This commit is contained in:
Alexander Alekhin
2020-12-11 17:21:48 +00:00
parent 8286d84fb1
commit f290ff215e
2 changed files with 29 additions and 5 deletions
+20 -1
View File
@@ -90,7 +90,7 @@ TEST(Features2D_ORB, _1996)
ASSERT_EQ(0, roiViolations);
}
TEST(Features2D_ORB, crash)
TEST(Features2D_ORB, crash_5031)
{
cv::Mat image = cv::Mat::zeros(cv::Size(1920, 1080), CV_8UC3);
@@ -123,4 +123,23 @@ TEST(Features2D_ORB, crash)
ASSERT_NO_THROW(orb->compute(image, keypoints, descriptors));
}
TEST(Features2D_ORB, regression_16197)
{
Mat img(Size(72, 72), CV_8UC1, Scalar::all(0));
Ptr<ORB> orbPtr = ORB::create();
orbPtr->setNLevels(5);
orbPtr->setFirstLevel(3);
orbPtr->setScaleFactor(1.8);
orbPtr->setPatchSize(8);
orbPtr->setEdgeThreshold(8);
std::vector<KeyPoint> kps;
Mat fv;
// exception in debug mode, crash in release
ASSERT_NO_THROW(orbPtr->detectAndCompute(img, noArray(), kps, fv));
}
}} // namespace