匹配项
查找匹配功能
Syntax
描述
返回两个输入功能集中匹配功能的索引。输入功能必须是indexPairs
= matchfeatures(功能1
,功能2
)binaryFeatures
对象或矩阵。
[
还返回匹配功能之间的距离,由indexPairs
,matchmetric
] = matchfeatures(功能1
,功能2
)indexPairs
。
[
includes additional options specified by one or moreindexPairs
,matchmetric
] = matchfeatures(功能1
,功能2
,名称,价值
)名称,价值
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);
Find Corresponding Points Using SURF Features
使用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');
输入参数
功能1
—Feature set 1
binaryFeatures
object|M1-经过-Nmatrix
功能集1,指定为binaryFeatures
对象或一个M1-经过-Nmatrix. The matrix containsM1功能和Ncorresponds to the length of each feature vector. You can obtain thebinaryFeatures
object using the提取物
function with the fast retina keypoint (FREAK), Oriented FAST and Rotated BRIEF (ORB), or binary robust invariant scalable keypoints (BRISK) descriptor method.
功能2
—Feature set 2
M2-经过-Nmatrix|binaryFeatures
object
Features set 2, specified as abinaryFeatures
对象或一个M2-经过-Nmatrix. The matrix containsM2features andNcorresponds to the length of each feature vector. You can obtain thebinaryFeatures
object 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
, 在哪里Name
is 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.
Method
—Matching method
“详尽”
(default) |'Approximate'
Matching method, specified as the comma-separated pair consisting of 'Method
' and either“详尽”
or'Approximate'
。这method specifies how nearest neighbors between功能1
and功能2
被发现。当它们之间的距离小于阈值设置的阈值时,两个特征向量匹配MatchThreshold
范围。
“详尽” |
Compute the pairwise distance between feature vectors in |
'Approximate' |
Use an efficient approximate nearest neighbor search. Use this method for large feature sets.[3] |
MatchThreshold
—匹配阈值
10.0
or1.0
(default) |percent value in the range (0, 100]
匹配阈值, 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.0
for binary feature vectors or to1.0
for 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
对象通常需要更大的匹配阈值值。这提取物
函数返回binaryFeatures
objects when extracting FREAK, ORB, or BRISK descriptors.
MaxRatio
—Ratio threshold
0.6
(default) |范围内的比率(0,1]
比率阈值,指定为逗号分隔对,由'MaxRatio
'和标量比在范围内(0,1)。使用最大比率拒绝模棱两可的匹配。增加此值以返回更多匹配项。
公制
—Feature matching metric
'SSD'
(default) |'伤心'
Feature matching metric, specified as the comma-separated pair consisting of '公制
' and either'伤心'
or'SSD'
。
'伤心' |
Sum of absolute differences |
'SSD' |
Sum of squared differences |
当输入功能集时,此属性适用功能1
and功能2
, are notbinaryFeatures
对象。当您将功能指定为binaryFeatures
objects, the function uses the Hamming distance to compute the similarity metric.
Output Arguments
matchmetric
— Distance between matching features
p-经过-1 vector
Distance between matching features, returned as ap-经过-1 vector. The value of the distances are based on the metric selected. Eachi元素在matchmetric
corresponds to thei在indexPairs
输出矩阵。什么时候公制
设置为SAD
orSSD
, the feature vectors are normalized to unit vectors before computation.
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
C/C ++代码生成
使用MATLAB®CODER™生成C和C ++代码。
用法注释和限制:
Generates platform-dependent library for MATLAB®host only when using the
详尽无遗
方法。生成可移植的C代码or non-host target only when using the
详尽无遗
方法。Generates portable C code using a C++ compiler that links to OpenCV (Version 3.4.0) libraries when not using the
详尽无遗
方法。看用于使用OPENCV库的功能的便携式C代码生成。'Method'
and“公制”
must be compile-time constants.
GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.
用法注释和限制:
CUDA®code is generated only for the
exhaustive
matching method. If theApproximate
method is selected, GPU Coder™ issues a warning and generates C/C++ code for this function.
Version History
matlab命令
You clicked a link that corresponds to this MATLAB command:
通过在MATLAB命令窗口中输入该命令。Web浏览器不支持MATLAB命令。万博1manbetx
选择一个网站
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:。
您还可以从以下列表中选择一个网站:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
美洲
- América Latina(Español)
- 加拿大(英语)
- 美国(英语)