如何在 OpenCV 中使用 FERN 描述符匹配器?它是否将某些算法(sift/surf?)提取的关键点作为输入关键点,或者它自己计算所有内容?
编辑:
我正在尝试将其应用于图像数据库
fernmatcher->add(all_images, all_keypoints);
fernmatcher->train();
有20张图像,总共不到8MB,我使用SURF提取关键点。内存使用量跃升至 2.6GB,训练需要天知道要花多长时间...
最佳答案
FERN 与其他匹配器没有什么不同。以下是使用 FERN 作为关键点描述符匹配器的示例代码。
int octaves= 3;
int octaveLayers=2;
bool upright=false;
double hessianThreshold=0;
std::vector<KeyPoint> keypoints_1,keypoints_2;
SurfFeatureDetector detector1( hessianThreshold, octaves, octaveLayers, upright );
detector1.detect( image1, keypoints_1 );
detector1.detect( image2, keypoints_2 );
std::vector< DMatch > matches;
FernDescriptorMatcher matcher;
matcher.match(image1,keypoints_1,image2,keypoints_2,matches);
Mat img_matches;
drawMatches( templat_img, keypoints_1,tempimg, keypoints_2,matches, img_matches,Scalar::all(-1), Scalar::all(-1),vector<char>(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS);
imshow( "Fern Matches", img_matches);
waitKey(0);
*但是我的建议是使用 FAST,它比 FERN 更快,而且 FERN 可以用来训练一组带有关键点的图像,训练后的 FERN 可以像所有其他分类器一样用作分类器。嗯>
关于image-processing - FernDescriptorMatch - 如何使用它?怎么运行的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10893797/