|
|
|
@ -375,3 +375,62 @@ TEST( Features2d_DescriptorExtractor, batch ) |
|
|
|
|
EXPECT_GT(descriptors[i].rows, 100); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST( Features2d_Feature2d, no_crash ) |
|
|
|
|
{ |
|
|
|
|
const String& pattern = string(cvtest::TS::ptr()->get_data_path() + "shared/*.png"); |
|
|
|
|
vector<String> fnames; |
|
|
|
|
glob(pattern, fnames, false); |
|
|
|
|
sort(fnames.begin(), fnames.end()); |
|
|
|
|
|
|
|
|
|
Ptr<AKAZE> akaze = AKAZE::create(); |
|
|
|
|
Ptr<ORB> orb = ORB::create(); |
|
|
|
|
Ptr<KAZE> kaze = KAZE::create(); |
|
|
|
|
Ptr<BRISK> brisk = BRISK::create(); |
|
|
|
|
size_t i, n = fnames.size(); |
|
|
|
|
vector<KeyPoint> keypoints; |
|
|
|
|
Mat descriptors; |
|
|
|
|
|
|
|
|
|
for( i = 0; i < n; i++ ) |
|
|
|
|
{ |
|
|
|
|
printf("%d. image: %s:\n", (int)i, fnames[i].c_str()); |
|
|
|
|
bool checkCount = strstr(fnames[i].c_str(), "templ.png") == 0; |
|
|
|
|
|
|
|
|
|
Mat img = imread(fnames[i], -1); |
|
|
|
|
printf("\tAKAZE ... "); fflush(stdout); |
|
|
|
|
akaze->detectAndCompute(img, noArray(), keypoints, descriptors); |
|
|
|
|
if( checkCount ) |
|
|
|
|
{ |
|
|
|
|
ASSERT_GT((int)keypoints.size(), 0); |
|
|
|
|
} |
|
|
|
|
ASSERT_EQ(descriptors.rows, (int)keypoints.size()); |
|
|
|
|
printf("ok\n"); |
|
|
|
|
|
|
|
|
|
printf("\tKAZE ... "); fflush(stdout); |
|
|
|
|
kaze->detectAndCompute(img, noArray(), keypoints, descriptors); |
|
|
|
|
if( checkCount ) |
|
|
|
|
{ |
|
|
|
|
ASSERT_GT((int)keypoints.size(), 0); |
|
|
|
|
} |
|
|
|
|
ASSERT_EQ(descriptors.rows, (int)keypoints.size()); |
|
|
|
|
printf("ok\n"); |
|
|
|
|
|
|
|
|
|
printf("\tORB ... "); fflush(stdout); |
|
|
|
|
orb->detectAndCompute(img, noArray(), keypoints, descriptors); |
|
|
|
|
if( checkCount ) |
|
|
|
|
{ |
|
|
|
|
ASSERT_GT((int)keypoints.size(), 0); |
|
|
|
|
} |
|
|
|
|
ASSERT_EQ(descriptors.rows, (int)keypoints.size()); |
|
|
|
|
printf("ok\n"); |
|
|
|
|
|
|
|
|
|
printf("\tBRISK ... "); fflush(stdout); |
|
|
|
|
brisk->detectAndCompute(img, noArray(), keypoints, descriptors); |
|
|
|
|
if( checkCount ) |
|
|
|
|
{ |
|
|
|
|
ASSERT_GT((int)keypoints.size(), 0); |
|
|
|
|
} |
|
|
|
|
ASSERT_EQ(descriptors.rows, (int)keypoints.size()); |
|
|
|
|
printf("ok\n"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|