Draw matching points between two images in MATLAB

I am working on a fingerprint recognition system and have completed the step in extracting features.

I have two sets of matching points between two images. I want to create an image so that two images are displayed side by side. This image should display matching points associated with the lines: one end of each line is connected to a coincidence point in the first image, and the other end of the line is connected to the corresponding coincidence point in the second image.

Thanks in advance.

+4
source share
2 answers

showMatchedFeatures, MATLAB. features, - , N x 2. , , . , .

, - , (, , , ).

MATLAB:

http://www.mathworks.com/help/vision/ref/showmatchedfeatures.html

, :

http://www.mathworks.com/help/vision/ref/showmatchedfeatures.html#btfmijs

: Computer Vision showMatchedFeatures. , . Computer Vision, , . , (uint8, uint16 ..) .

, Image Processing Toolbox, - :

% Assuming im1 and im2 are already loaded into your environment
% im1 and im2 are the two images you are comparing to
% points1 and points2 are M x 2 matrices of corresponding points
% between im1 and im2
% The co-ordinates in the ith row of points1 correspond to the
% ith row of points2
% Important Note: Each row assumes co-ordinates in (x,y) format
% x - horizontal, y - vertical
% y is assumed to be y-down (i.e. downwards is positive)

figure;
stackedImage = cat(2, im1, im2); % Places the two images side by side
imshow(stackedImage);
width = size(im1, 2);
hold on;
numPoints = size(points1, 1); % points2 must have same # of points
% Note, we must offset by the width of the image
for i = 1 : numPoints
    plot(points1(i, 1), points1(i, 2), 'y+', points2(i, 1) + width, ...
         points2(i, 2), 'y+');
    line([points1(i, 1) points2(i, 1) + width], [points1(i, 2) points2(i, 2)], ...
         'Color', 'yellow');
end

, showMatchedFeatures.


, ?

, , , (.. / ), , , - - sum. . , , :

figure;
[rows1,cols1] = size(im1);
[rows2,cols2] = size(im2);

%// Create blank image
stackedImage = zeros(max([rows1,rows2]), cols1+cols2);
stackedImage = cast(stackedImage, class(im1)); %// Make sure we cast output
%// Place two images side by side
stackedImage(1:rows1,1:cols1) = im1;
stackedImage(1:rows2,cols1+1:cols1+cols2) = im2;

%// Code from before
imshow(stackedImage);
width = size(im1, 2);
hold on;
numPoints = size(points1, 1); % points2 must have same # of points
% Note, we must offset by the width of the image
for i = 1 : numPoints
    plot(points1(i, 1), points1(i, 2), 'y+', points2(i, 1) + width, ...
         points2(i, 2), 'y+');
    line([points1(i, 1) points2(i, 1) + width], [points1(i, 2) points2(i, 2)], ...
         'Color', 'yellow');
end
+4

, , rayryeng , ( , xy xy)

figure;
[rows1,cols1] = size(im1(:,:,1));
[rows2,cols2] = size(im2(:,:,1));
%// Create blank image
stackedImage = uint8(zeros(max([rows1,rows2]), cols1+cols2,3));
%// Place two images side by side
stackedImage(1:rows1,1:cols1,:) = im1;
stackedImage(1:rows2,cols1+1:cols1+cols2,:) = im2;
%// Code from before
imshow(stackedImage);
width = size(im1(:,:,1), 2);
hold on;
numPoints = size(points1, 2); % points2 must have same # of points
% Note, we must offset by the width of the image
for i = 1 : numPoints
    plot(points1(1, i), points1(2, i), 'b*', points2(1, i) + width, ...
         points2(2, i), 'r*');
    line([points1(1, i) points2(1, i) + width], [points1(2, i) points2(2, i)], ...
         'Color', 'green');
end
+1

Source: https://habr.com/ru/post/1534056/


All Articles