主要内容

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

cornerPoints

用于存储角点的对象

说明

该对象存储从二维灰度图像中检测到的点要素的相关信息。

创建对象

描述

points = cornerPoints(location) 根据一个包含位置坐标的 M×2 数组 [x y] 构建一个 cornerPoints 目标。

示例

points = cornerPoints(location,Name,Value) 使用一个或多个名称-值对来设置属性。用引号将每个属性名称引起来。例如,points = cornerPoints('Metric',0.0)

输入参量

全部展开

点的坐标,指定为一个由 M 元素组成的、按 2 个元素为一组排列的 [x y] 坐标数组。

属性

全部展开

此 属性 为只读。

关键点的位置,指定为一个 M×2 矩阵。每一行都采用 [x y] 的格式,表示一个关键点的位置。M 表示关键点的数量。无法设置此属性,请改用 location 参量。

角点对象持有的点数,指定为数值。

检测特征的强度,指定为数值。该算法使用了近似海森矩阵的行列式。

对象函数

plot绘制检测到的特征点
isempty判断 points 对象是否为空
length存储的点数
selectStrongest选择度量最高的点
sizepoints 对象的返回大小
selectUniformSelect uniformly distributed subset of point features
selectSelect point or region features during code generation
gatherRetrieve cornerPoints from the GPU

示例

全部折叠

读取一个图像。

I = imread('cameraman.tif');

检测点特征。

points = detectHarrisFeatures(I);

显示十个最强点。

strongest = selectStrongest(points,10);
imshow(I)
hold on
plot(strongest)

Figure contains an axes object. The hidden axes object contains 2 objects of type image, line. One or more of the lines displays its values using only markers

显示强度最大的点的 (x,y) 坐标。

strongest.Location
ans = 10×2 single matrix

  112.4516  208.4412
  108.6510  228.1681
  136.6969  114.7962
  181.4160  205.9876
  135.5823  123.4529
  100.4951  174.3253
  146.7581   94.7393
  135.2899   92.6485
  129.8439  110.0350
  130.5716   91.0424

创建一个棋盘格图像。

I = checkerboard(50,2,2);

加载角点的坐标位置。

location = [51    51    51   100   100   100   151   151   151; ...
            50   100   150    50   101   150    50   100   150]';

将这些点保存到一个 cornerPoints 对象中。

points = cornerPoints(location);

在棋盘格上显示这些点。

imshow(I)
hold on
plot(points)

Figure contains an axes object. The hidden axes object contains 2 objects of type image, line. One or more of the lines displays its values using only markers

提示

尽管 cornerPoints 可能包含许多点,但它是一个标量对象。因此,numel(cornerPoints) 始终返回 1。该值可能与 length(cornerPoints) 不同,后者返回该对象实际持有的点数。

扩展功能

全部展开

版本历史记录

在 R2012a 中推出