简体   繁体   English

如何选择好的SURF功能要点?

[英]How to choose good SURF feature keypoints?

I am currently working on object classification problem. 我目前正在研究对象分类问题。 My objective is to use the SURF descriptors to train MLP based artificial neural network in opencv and generate a model for object classification. 我的目标是使用SURF描述符在opencv中训练基于MLP的人工神经网络,并生成用于对象分类的模型。 So far, I have achieved the following: 到目前为止,我已经实现了以下目标:

I am computing SURF keypoints using the following code: 我正在使用以下代码计算SURF关键点:

vector<KeyPoint> computeSURFKeypoints(Mat image) {
    SurfFeatureDetector surfdetector(400, 4, 2, true, false);
    vector<KeyPoint> keypoints;
    surfdetector.detect(image, keypoints);
    return keypoints;
}

I compute the SURF descriptors over these keypoints using the following code: 我使用以下代码在这些关键点上计算SURF描述符:

Mat computeSURFDescriptors(Mat image, vector<KeyPoint> keypoints) {
    SurfDescriptorExtractor extractor;
    Mat descriptors;
    extractor.compute(image, keypoints, descriptors);
    return descriptors;
}

The problem which I am facing is that the size of the descriptor varies from image to image. 我面临的问题是描述符的大小因图像而异。 The descriptor contains 64 elements FOR EACH FEATURE POINT. 描述符包含64个用于每个功能点的元素。 For the purpose of training the neural network, I want the size of descriptor to be fixed. 为了训练神经网络,我希望描述符的大小固定。 For that, I am using PCA to reduce the descriptor size as follows: 为此,我使用PCA来减少描述符的大小,如下所示:

Mat projection_result;
PCA pca(descriptors, Mat(), CV_PCA_DATA_AS_COL, 64);
pca.project(descriptors,projection_result);
return projection_result;

In doing so, I am able to reduce the dimensions of descriptor, but the selected feature points are not representative of the image and they result in poor matching results. 这样,我可以减小描述符的尺寸,但是所选特征点不能代表图像,并且它们会导致较差的匹配结果。 How can I reduce the dimension of descriptor by retaining good feature points? 如何通过保留良好的特征点来缩小描述符的维数? Any help will be appreciated. 任何帮助将不胜感激。

I was searching for something completely else, so no expert, but I happen to know that Matlab has a feature 'points.selectstrongest(x)', were x is the amount of points you want. 我完全在寻找其他东西,所以没有专家,但是我碰巧知道Matlab具有'points.selectstrongest(x)'功能,因为x是您想要的点数。 The feature picks the points with the strongest metric. 该功能选择指标最强的点。

The metric is a property given to SURFpoints by the Matlab function 'detectSURFFeatures'. 度量是Matlab函数“ detectSURFFeatures”赋予SURFpoint的属性。 I the Metric is given in 'detectSURFFeatures' by the OpenCV function 'vision.internal.buildable.fastHessianDetectorBuildable.fastHessianDetector_uint8' 我通过OpenCV函数'vision.internal.buildable.fastHessianDetectorBuildable.fastHessianDetector_uint8'在'detectSURFFeatures'中给出了度量标准

You can use the response value of each keypoint returned in feature detection. 您可以使用在功能检测中返回的每个关键点的响应值。 Sorting the keypoints according to their response value should be the way to go, however I have never tested this. 按照关键点的响应值对关键点进行排序应该是可行的方法,但是我从未测试过。

See: https://github.com/Itseez/opencv/blob/master/modules/core/include/opencv2/core/types.hpp#L697 参见: https : //github.com/Itseez/opencv/blob/master/modules/core/include/opencv2/core/types.hpp#L697

Assuming you are talking about different number of keypoints in each image (and not different descriptor length). 假设您正在谈论每个图像中不同数量的关键点 (而不是不同的描述符长度)。 It does not make much sense that the number of keypoints will be the same, it is not a one-to-one connection. 关键点的数量相同是没有多大意义的,它不是一对一的连接。 So, I don't know what is the idea behind doing PCA, in each image you will get different results. 因此,我不知道进行PCA背后的想法是什么,在每个图像中您都会得到不同的结果。

There are some other common ways to check features correspondence, see Feature matching . 还有其他一些常见的方法来检查要素的对应关系,请参阅要素匹配 Bascially, they check the distance between the descriptors vectors. 基本上,他们检查描述符向量之间的距离。

I think you are trying to do something a bit different than features matching, so I would suggest looking on object detection 我认为您正在尝试做一些与功能匹配有所不同的事情,所以我建议您看一下物体检测

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM