You are not saving the correct information. When you save a .fig, you are only saving the plot.
You need to save I1
and points1
:
I1 = rgb2gray(imread('/home/colin/downloads/matlabImages/template.jpg'));
points1 = detectHarrisFeatures(I1);
save('im1.mat', 'I1','points1');
Now you can use the info:
load('im1.mat');%This loads I1 and points1
I2 = rgb2gray(imread('/home/colin/downloads/matlabImages/small.jpg'));
points2 = detectHarrisFeatures(I2);
[features2, valid_points2] = extractFeatures(I2, points2);
[features1, valid_points1] = extractFeatures(I1, points1);
indexPairs = matchFeatures(features1, features2);
Optionally, you can compute the features1
variable in the first step and save it (instead of using I1
and points1
):
I1 = rgb2gray(imread('/home/colin/downloads/matlabImages/template.jpg'));
points1 = detectHarrisFeatures(I1);
[features1, valid_points1] = extractFeatures(I1, points1);
save('im1.mat', 'features1');
load('im1.mat');%This loads features1
I2 = rgb2gray(imread('/home/colin/downloads/matlabImages/small.jpg'));
points2 = detectHarrisFeatures(I2);
[features2, valid_points2] = extractFeatures(I2, points2);
indexPairs = matchFeatures(features1, features2);