cornerPoints class

Object for storing corner points

Description

This object stores information about feature points detected from a 2-D grayscale image.

Tips

Although cornerPoints may hold many points, it is a scalar object. Therefore, NUMEL(cornerPoints) always returns 1. This value may differ from LENGTH(cornerPoints), which returns the true number of points held by the object.

Construction

points = cornerPoints(Location) constructs a cornerPoints object from an M-by-2 array of [x y] point coordinates, Location.

points = cornerPoints(Location,Name,Value) constructs a cornerPoints object with optional input properties specified by one or more Name,Value pair arguments. Each additional property can be specified as a scalar or a vector whose length matches the number of coordinates in Location.

Code Generation Support
Compile-time constant inputs: No restriction.
Supports MATLAB Function block: No
To index locations with this object, use the syntax: points.Location(idx,:), for points object. See visionRecovertformCodeGeneration_kernel.mvisionRecovertformCodeGeneration_kernel.m, which is used in the Introduction to Code Generation with Feature Matching and Registration example.
Code Generation Support, Usage Notes, and Limitations

Input Arguments

Location

M-by-2 array of [x y] point coordinates.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

'Count'

Number of points held by the object.

Default: 0

'Metric'

Value describing strength of detected feature.

Default: 0.0

Methods

gatherRetrieve cornerPoints from the GPU
isemptyReturns true for empty object
lengthNumber of stored points
plotPlot corner points
selectStrongestReturn points with strongest metrics
sizeSize of the cornerPoints object

Examples

expand all

Plot Strongest Features from Detected Feature Points

Read image.

    I = imread('cameraman.tif');

Detect feature points.

    points = detectHarrisFeatures(I);

Display the 10 strongest points.

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

Display the (x,y) coordinates.

    strongest.Location
ans =

  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

Create a Corner Points Object and Display Points

Create a checkerboard image.

    I = checkerboard(50,2,2);

Load the locations.

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

Save points.

    points = cornerPoints(location);

Display points on checkerboard.

    imshow(I); hold on;
    plot(points);

Was this topic helpful?