Main Content

selectUniform

Select uniformly distributed subset of point features

Description

pointsOut = selectUniform(points,N,imageSize) returns N uniformly distributed points with the strongest metrics.

example

Examples

collapse all

Read an image.

im = imread("yellowstone_left.png");

Detect and display KAZE features.

points1 = detectKAZEFeatures(im2gray(im))
points1 = 
  6713x1 KAZEPoints array with properties:

       Location: [6713x2 single]
         Metric: [6713x1 single]
          Count: 6713
          Scale: [6713x1 single]
    Orientation: [6713x1 single]

subplot(1,2,1)
imshow(im)
hold on
plot(points1)
hold off
title("Original Points")

Select a uniformly distributed subset of points.

numPoints = 100;
points2 = selectUniform(points1,numPoints,size(im))
points2 = 
  100x1 KAZEPoints array with properties:

       Location: [100x2 single]
         Metric: [100x1 single]
          Count: 100
          Scale: [100x1 single]
    Orientation: [100x1 single]

subplot(1,2,2)
imshow(im)
hold on
plot(points2)
hold off
title("Uniformly Distributed Points")

Figure contains 2 axes objects. Hidden axes object 1 with title Original Points contains 3 objects of type image, line. One or more of the lines displays its values using only markers Hidden axes object 2 with title Uniformly Distributed Points contains 3 objects of type image, line. One or more of the lines displays its values using only markers

Load an image.

im = imread("yellowstone_left.png");

Detect many corners by reducing the quality threshold.

points1 = detectHarrisFeatures(im2gray(im),MinQuality=0.05);

Plot image with detected corners.

subplot(1,2,1);
imshow(im);
hold on
plot(points1);
hold off
title("Original points");

Select a uniformly distributed subset of points.

numPoints = 100;
points2 = selectUniform(points1,numPoints,size(im));

Plot images showing original and subset of points.

subplot(1, 2, 2);
imshow(im);
hold on
plot(points2);
hold off
title("Uniformly distributed points");

Figure contains 2 axes objects. Hidden axes object 1 with title Original points contains 2 objects of type image, line. One or more of the lines displays its values using only markers Hidden axes object 2 with title Uniformly distributed points contains 2 objects of type image, line. One or more of the lines displays its values using only markers

Load an image into the workspace.

im = imread("yellowstone_left.png");

Detect many corners by reducing the quality threshold.

points1 = detectBRISKFeatures(im2gray(im),MinQuality=0.05);

Plot image with detected corners.

subplot(1,2,1);
imshow(im);
hold on
plot(points1);
hold off
title("Original points");

Select a uniformly distributed subset of points.

numPoints = 100;
points2 = selectUniform(points1,numPoints,size(im));

Plot images showing original and subset of points.

subplot(1, 2, 2);
imshow(im);
hold on
plot(points2);
hold off
title("Uniformly distributed points");

Figure contains 2 axes objects. Hidden axes object 1 with title Original points contains 3 objects of type image, line. One or more of the lines displays its values using only markers Hidden axes object 2 with title Uniformly distributed points contains 3 objects of type image, line. One or more of the lines displays its values using only markers

Load an image.

im = imread("yellowstone_left.png");

Detect and display SURF features.

points1 = detectSURFFeatures(im2gray(im));
subplot(1,2,1);
imshow(im);
hold on
plot(points1);
hold off
title("Original points");

Select a uniformly distributed subset of points.

numPoints = 100;
points2 = selectUniform(points1,numPoints,size(im));

Plot images showing original and subset of points.

subplot(1, 2, 2);
imshow(im);
hold on
plot(points2);
hold off
title("Uniformly distributed points");

Figure contains 2 axes objects. Hidden axes object 1 with title Original points contains 3 objects of type image, line. One or more of the lines displays its values using only markers Hidden axes object 2 with title Uniformly distributed points contains 3 objects of type image, line. One or more of the lines displays its values using only markers

Input Arguments

collapse all

Points object,specified as an M-by-2 matrix of M number of [x y] coordinates, or as one of the point feature objects described in Point Feature Types. The object contains information about the point features detected in the input image. To obtain points, use the appropriate detect function that pairs with the point feature type.

Number of uniformly distributed points to select, specified as an integer.

Size of image, specified as a 2-element vector for grayscale images or a 3-element vector for truecolor images.

Output Arguments

collapse all

Uniformly distributed points, returned as a points feature object.

Version History

Introduced in R2012a