% showQuerySURFLines.m
% Shows the geometric SURF correspondence between query and database images.

printTitle('Showing query features ...');

% Loop over all input images
if ~exist('queryFilenames', 'var')
    load(SURFQueryMAT);
end
if ~exist('databaseFilenames', 'var')
    load(SURFDatabaseMAT);
end
numImages = length(queryFilenames);
for nImage = 28
    
    disp(sprintf('\nShowing image %d ... \n', nImage));
    
    % Choose image 1 parameters
    frame1 = queryFrames{nImage};
    desc1 = queryDescriptors{nImage};    
    file1 = queryFilenames{nImage};
    figure(1); clf;
    subplot(1,2,1);
    warning off;
    showSURF(queryImagesGray{nImage}, frame1);
    title(sprintf('image %d: features %d', nImage, size(frame1,1)));
    warning on;
    
    % Choose image 2 parameters
    nImageDB = queryToDatabaseNumbers(nImage);
    frame2 = databaseFrames{nImageDB};
    desc2 = databaseDescriptors{nImageDB};
    file2 = databaseFilenames{nImageDB};
    subplot(1,2,2);
    warning off;
    showSURF(file2, frame2);
    title(sprintf('image %d: features %d', queryToDatabaseNumbers(nImage), size(frame2,1)));
    warning on;
    
    % Match
    figure(2); clf;
    warning off
    SURFPairwiseMatchFeatureSets(frame1, desc1, file1, frame2, desc2, file2, 'euclidean', 1);
    warning on;
    
    pause;
    
end % nImage