image file loading

3 次查看(过去 30 天)
Preetam Sundaray
Preetam Sundaray 2012-6-8
i am trying to compare two images using matlab.first i have create keypoints n then match it. Here is d programing
function num=match(image1,image2)
[im1,des1,loc1]=sift(image1);
[im2,des2,loc2]=sift(image2);
showkeys(im1,loc1);
distRatio=0.6;
des2t =des2';
for i = 1 :size(des1,1)
dotprods = des1(1:i)* des2t;
[vals,indx] = sort(acos(dotprods));
if (vals(1) < distRatio * vals(2))
match(i) = indx(1);
else
match(i) = 0;
end
end
im3 = appendimages(im1,im2);
figure('Position', [100 100 size(im3,2) size(im3,1)]);
colormap('gray');
imagesc(im3);
hold on;
cols1 = size(im1,2);
for i = 1: size(des1,1)
if (match(i) > 0)
line([loc1(i,2) loc2(match(i),2)+cols1], ...
[loc1(i,1) loc2(match(i),1)], 'Color', 'c');
end
end
hold off
num = sum(match >0);
fprintf('Found %d matches.\n', num);
my question is how to define this image1 and image2. I hav two images in jpg format.kindly help me

回答(1 个)

Walter Roberson
Walter Roberson 2012-6-11
im1 = imread('FirstImage.jpg');
im2 = imread('SecondImage.jpg');
match_output = match(im1, im2);

类别

Help CenterFile Exchange 中查找有关 Biomedical Imaging 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by