主要内容

本页采用了机器翻译。点击此处可查看英文原文。

showMatchedFeatures

显示相应的特征点

说明

showMatchedFeatures(I1,I2,matchedPoints1,matchedPoints2) 显示了图像 I1I2 的叠加图,其中用颜色编码绘制了相应点的位置,并用直线将这些点连接起来。matchedPoints1matchedPoints2 包含 I1I2 中相应点的坐标。

示例

showMatchedFeatures(I1,I2,matchedPoints1,matchedPoints2,method) 使用由 method 参数指定的可视化样式显示图像 I1I2

示例

showMatchedFeatures(___,PlotOptions, {MarkerStyle1, MarkerStyle2, LineStyle}) 允许您在包含三个值的元胞数组中指定自定义绘图选项。MarkerStyle1MarkerStyle2LineStyle 的值分别对应 I1 中的标记符号、I2 中的标记符号,以及线条样式和颜色。plot 函数的 LineSpec 语法定义了每个限定符。

showMatchedFeatures(___,Name=Value) 支持上述语法中的任何参量组合,且可使用一个或多个名称-值参量指定选项。例如,showMatchedFeatures(__,PlotOptions={"d","+","g"}) 将标记样式设置为菱形(用于 I1),加号(用于 I2),并将颜色设置为绿色。

H = showMatchedFeatures(___) 返回由 showMatchedFeatures 返回的图像对象的句柄。

示例

全部折叠

读取图像。

I1 = im2gray(imread("parkinglot_left.png"));
I2 = im2gray(imread("parkinglot_right.png"));

检测 Harris 特征。

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

提取特征。

[f1,vpts1] = extractFeatures(I1,points1);
[f2,vpts2] = extractFeatures(I2,points2);

匹配特征。

indexPairs = matchFeatures(f1,f2);
matchedPoints1 = vpts1(indexPairs(1:20,1));
matchedPoints2 = vpts2(indexPairs(1:20,2));

可视化候选匹配结果。

figure; 
showMatchedFeatures(I1,I2,matchedPoints1,matchedPoints2,"montage");
title("Candidate point matches");
legend("Matched points 1","Matched points 2");

Figure contains an axes object. The hidden axes object with title Candidate point matches contains 4 objects of type image, line. One or more of the lines displays its values using only markers These objects represent Matched points 1, Matched points 2.

读取图像。

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

检测 SURF 特征。

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

提取特征。

[f1,vpts1] = extractFeatures(I1,points1);
[f2,vpts2] = extractFeatures(I2,points2);

匹配特征。

indexPairs = matchFeatures(f1,f2);
matchedPoints1 = vpts1(indexPairs(:,1));
matchedPoints2 = vpts2(indexPairs(:,2));

可视化候选匹配结果。

figure;
showMatchedFeatures(I1,I2,matchedPoints1,matchedPoints2);
title("Putative point matches");
legend("Matched points 1","Matched points 2");

Figure contains an axes object. The hidden axes object with title Putative point matches contains 4 objects of type image, line. One or more of the lines displays its values using only markers These objects represent Matched points 1, Matched points 2.

输入参数

全部折叠

第一个输入图像,指定为一个数值数组。

第二个输入图像,指定为一个数值数组。

图像一中各点的坐标,指定为一个 M 行 2 列的矩阵,其中包含 M 个 [x y] 坐标,或者指定为 Point Feature Types 中描述的点特征对象之一。

图像二中各点的坐标,指定为一个 M 行 2 列的矩阵,其中包含 M 个 [x y] 坐标,或者指定为 Point Feature Types 中描述的点特征对象之一。

显示样式方法,指定为以下选项之一:

falsecolor通过创建一张将 I1 显示为红色、I2 显示为青色的红-青合成图像,将这些图像叠加在一起。
blend 使用 alpha 混合叠加 I1I2
montageI1I2 并排放置在同一个图像中。

名称-值参数

全部折叠

将可选参量对组指定为 Name1=Value1,...,NameN=ValueN,其中 Name 是参量名称,Value 是对应的值。名称-值参量必须出现在其他参量之后,但对各个参量对组的顺序没有要求。

示例: showMatchedFeatures(__,PlotOptions={"d","+","g"})I1 的标记样式设置为菱形,将 I2 的标记样式设置为加号,并将颜色设置为绿色。

标记、线条样式和颜色选项,指定为字符向量元胞数组或字符串数组。这三个值 {MarkerStyle1MarkerStyle2LineStyle} 分别对应 I1 中的标记符号、I2 中的标记符号,以及线条样式和颜色。plot 函数的 LineSpec 语法定义了每个限定符。

用于显示可视化的输出坐标区,指定为一个 axes 图形对象。

输出参量

全部折叠

showMatchedFeatures 显示的图像对象的句柄。

版本历史记录

在 R2012b 中推出