使用OpenCV从小图像中提取点描述符 [英] Extract point descriptors from small images using OpenCV

查看:142
本文介绍了使用OpenCV从小图像中提取点描述符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试提取不同的点描述符(SIFT,SURF,ORB,BRIEF等)来构建可视化词袋.问题似乎是我使用的图像非常小:12x60px. 使用密集提取器,我可以获得一些关键点,但是当提取描述符时,就不会提取任何数据.

I am trying to extract different point descriptors (SIFT, SURF, ORB, BRIEF,...) to build Bag of Visual words. The problem seems to be that I am using very small images : 12x60px. Using a dense extractor I am able to get some keypoints, but then when extracting the descriptor no data is extracted.

这是代码:

vector<KeyPoint> points;
Mat descriptor; // descriptor of the current image
Ptr<DescriptorExtractor> extractor = DescriptorExtractor::create("BRIEF");
Ptr<FeatureDetector> detector(new DenseFeatureDetector(1.f,1,0.1f,6,0,true,false));
image = imread(filename, 0);
roi = Mat(image,Rect(0,0,12,60));

detector->detect(roi,points);

extractor->compute(roi,points,descriptor);
cout << descriptor << endl;

结果是[](带有Brief和ORB)和SegFault(带有SURF和SIFT). 有没有人知道如何从OpenCV的小图像中密集提取点描述符? 感谢您的帮助.

The result is [] (with BRIEF and ORB) and SegFault (with SURF and SIFT). Does anyone have a clue on how to densely extract point descriptors from small images on OpenCV ? Thanks for your help.

推荐答案

BRIEF和ORB使用32x32补丁来获取描述符.由于它不适合您的图像,因此他们删除了这些关键点(以避免返回没有描述符的关键点).

BRIEF and ORB use a 32x32 patch to get the descriptor. Since it doesn't fit your image, they remove those keypoints (to avoid returning keypoints without descriptor).

对于SURF和SIFT,它们可以使用较小的补丁,但这取决于关键点提供的规模.在这种情况下,我想他们必须使用更大的补丁,并且与以前一样.不过,我不知道为什么会出现段错误;也许SIFT/SURF描述符提取器不会像BILF/ORB那样检查关键点是否在图像边界之内.

In the case of SURF and SIFT, they can use smaller patches, but it depends on the scale provided by the keypoint. In this case, I guess they have to use a bigger patch and the same as before happens. I don't know why you get a segfault, though; maybe the SIFT/SURF descriptor extractors don't check that keypoints are inside the image boundaries, as BRIEF/ORB ones do.

这篇关于使用OpenCV从小图像中提取点描述符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆