主要内容

匹配项

查找匹配功能

描述

example

indexPairs= matchfeatures(功能1,功能2)返回两个输入功能集中匹配功能的索引。输入功能必须是binaryFeatures对象或矩阵。

[indexPairs,matchmetric] = matchfeatures(功能1,功能2)还返回匹配功能之间的距离,由indexPairs

[indexPairs,matchmetric] = matchfeatures(功能1,功能2,名称,价值)includes additional options specified by one or more名称,价值pair arguments.

例子

全部收缩

Find corresponding interest points between a pair of images using local neighbhorhoods and the Harris algorithm.

阅读立体声图像。

I1 = im2gray(imread('viprectification_deskLeft.png');I2 = im2gray(imread('viprectification_deskRight.png');

Find the corners.

points1 = detectHarrisFeatures(I1); points2 = detectHarrisFeatures(I2);

Extract the neighborhood features.

[功能1,有效_points1] = ExtractFeatures(i1,points1);[功能2,有效_points2] = ExtractFeatures(i2,points2);

Match the features.

indexpairs = matchfeatures(features1,fiferty2);

检索每个图像的相应点的位置。

匹配点1 =有效_points1(indexpairs(:,1),:);匹配点2 =有效_points2(indexpairs(:,2),:);

Visualize the corresponding points. You can see the effect of translation between the two images despite several erroneous matches.

数字;ShowMatchedFeatures(I1,I2,MatchedPoints1,MatchedPoints2);

Figure contains an axes object. The axes object contains 4 objects of type image, line.

使用Surf局部特征检测器函数来查找两个相互旋转和缩放的两个图像之间的相应点。

阅读两个图像。

i1 = imread('cameraman.tif');I2 = imresize(imrotate(I1,-20),1.2);

Find the SURF features.

点1 =检测表(I1);point2 =检测表(i2);

提取功能。

[F1,VPTS1] = ExtractFeatures(I1,Points1);[F2,vpts2] =提取器(i2,points2);

Retrieve the locations of matched points.

indexpairs = matchfeatures(f1,f2);匹配点1 = vpts1(indexpairs(:,1));匹配点2 = vpts2(indexpairs(:,2));

显示匹配点。数据仍然包括几个离群值,但是您可以看到旋转和缩放对匹配功能的显示的影响。

数字;ShowMatchedFeatures(I1,I2,MatchedPoints1,MatchedPoints2);传奇('matched points 1','matched points 2');

Figure contains an axes object. The axes object contains 4 objects of type image, line. These objects represent matched points 1, matched points 2.

输入参数

全部收缩

功能集1,指定为binaryFeatures对象或一个M1-经过-Nmatrix. The matrix containsM1功能和Ncorresponds to the length of each feature vector. You can obtain thebinaryFeaturesobject using the提取物function with the fast retina keypoint (FREAK), Oriented FAST and Rotated BRIEF (ORB), or binary robust invariant scalable keypoints (BRISK) descriptor method.

Features set 2, specified as abinaryFeatures对象或一个M2-经过-Nmatrix. The matrix containsM2features andNcorresponds to the length of each feature vector. You can obtain thebinaryFeaturesobject using the提取物function with the fast retina keypoint (FREAK), Oriented FAST and Rotated BRIEF (ORB), or binary robust invariant scalable keypoints (BRISK) descriptor method.

Name-Value Arguments

Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN, 在哪里Nameis the argument name andValue是相应的值。名称值参数必须在其他参数之后出现,但是对的顺序并不重要。

Before R2021a, use commas to separate each name and value, and encloseName用引号。

例子:“公制”,'SSD'specifies the sum of squared differences for the feature matching metric.

Matching method, specified as the comma-separated pair consisting of 'Method' and either“详尽”or'Approximate'。这method specifies how nearest neighbors between功能1and功能2被发现。当它们之间的距离小于阈值设置的阈值时,两个特征向量匹配MatchThreshold范围。

“详尽”

Compute the pairwise distance between feature vectors in功能1and功能2

'Approximate'

Use an efficient approximate nearest neighbor search. Use this method for large feature sets.[3]

匹配阈值, specified as the comma-separated pair consisting of 'MatchThreshold' and a scalar percent value in the range (0,100]. The default values are set to either10.0for binary feature vectors or to1.0for nonbinary feature vectors. You can use the match threshold for selecting the strongest matches. The threshold represents a percent of the distance from a perfect match.

当它们之间的距离小于设置的阈值时,两个特征向量匹配MatchThreshold。这function rejects a match when the distance between the features is greater than the value ofMatchThreshold。增加价值以返回更多匹配项。

输入binaryFeatures对象通常需要更大的匹配阈值值。这提取物函数返回binaryFeaturesobjects when extracting FREAK, ORB, or BRISK descriptors.

比率阈值,指定为逗号分隔对,由'MaxRatio'和标量比在范围内(0,1)。使用最大比率拒绝模棱两可的匹配。增加此值以返回更多匹配项。

Feature matching metric, specified as the comma-separated pair consisting of '公制' and either'伤心'or'SSD'

'伤心' Sum of absolute differences
'SSD' Sum of squared differences

当输入功能集时,此属性适用功能1and功能2, are notbinaryFeatures对象。当您将功能指定为binaryFeaturesobjects, the function uses the Hamming distance to compute the similarity metric.

独特的匹配项,指定为逗号分隔对,由'Unique' and either错误的ortrue。将此值设置为true仅返回唯一的匹配功能1and功能2

当您设置时Uniqueto错误的,该功能返回所有匹配项功能1and功能2。Multiple features in功能1可以与一个功能匹配功能2

column representing features 1 with entry 1 and 3 circled and pointing to entry 2 of a column representing features 2

当您设置时Uniquetotrue,该功能执行前向匹配以选择唯一的匹配。匹配后功能1to功能2, 它匹配功能2to功能1并保持最佳匹配。

Output Arguments

全部收缩

Indices of corresponding features between the two input feature sets, returned as aP-by-2矩阵ofP索引数量。每个索引对对应于功能1and功能2输入。第一个元素将功能索引功能1。第二个元素索引匹配功能功能2

Distance between matching features, returned as ap-经过-1 vector. The value of the distances are based on the metric selected. Eachi元素在matchmetriccorresponds to theiindexPairs输出矩阵。什么时候公制设置为SADorSSD, the feature vectors are normalized to unit vectors before computation.

公制 范围 Perfect Match Value
SAD [0,2*SQRT(size(功能1,2))]. 0
SSD [0,4] 0
Hamming [0, features1.NumBits] 0

References

[1] Lowe, David G. "Distinctive Image Features from Scale-Invariant Keypoints."国际计算机视觉杂志。Volume 60, Number 2, pp. 91–110.

[2] Muja,M。和D. G. Lowe。“二进制功能的快速匹配”。Conference on Computer and Robot Vision。CRV,2012年。

[3] Muja,M。和D. G. Lowe。“具有自动算法配置的快速近似最近的邻居。”International Conference on Computer Vision Theory and Applications。VISAPP, 2009.

[4] Rublee, E., V. Rabaud, K. Konolige and G. Bradski. "ORB: An efficient alternative to SIFT or SURF." In2011年国际计算机视觉会议论文集, 2564–2571. Barcelona, Spain, 2011.

Extended Capabilities

Version History

在R2011a中引入