Main Content

findTracks

Find matched points across multiple views

Description

example

tracks = findTracks(vSet) finds and returns point tracks across multiple views in the view set, vSet. Each track contains 2-D projections of the same 3-D world point.

tracks = findTracks(vSet,viewIds) finds point tracks across a subset of views specified by viewIds.

tracks = findTracks(___,'MinTrackLength',trackLength) specifies the minimum length of the tracks.

Examples

collapse all

Load images in the workspace.

imageDir = fullfile(toolboxdir('vision'),'visiondata','structureFromMotion');
images = imageDatastore(imageDir);

Compute features for the first image.

I = im2gray(readimage(images,1));
pointsPrev = detectSURFFeatures(I);
[featuresPrev,pointsPrev] = extractFeatures(I,pointsPrev);

Create an image view set and add one view to the set.

vSet = imageviewset;
vSet = addView(vSet,1,'Features',featuresPrev,'Points',pointsPrev);

Compute features and matches for the rest of the images.

for i = 2:numel(images.Files)
  I = im2gray(readimage(images, i));
  points = detectSURFFeatures(I);
  [features, points] = extractFeatures(I,points);
  vSet = addView(vSet,i,'Features',features,'Points',points);
  pairsIdx = matchFeatures(featuresPrev,features);
  vSet = addConnection(vSet,i-1,i,'Matches',pairsIdx);
  featuresPrev = features;
end

Find point tracks across views in the image view set.

tracks = findTracks(vSet);

Input Arguments

collapse all

Image view set, specified as an imageviewset object.

View identifiers, specified as a vector of positive integers. View identifiers are unique to a specific view.

Minimum length of the tracks, specified as a positive integer equal to or greater than 2.

Output Arguments

collapse all

Point tracks across multiple views, returned as a pointTrack object.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2020a