How to combine two images based off matched features?
5 ビュー (過去 30 日間)
古いコメントを表示
Hi, I am trying to combine these 2 images based off their similarities? I am using matched features and would like to sort of blend them together such that they appear as a single image. The only thing I'm not sure how to do is "merging" them together using said matched features. Any help is greatly appreciated, thank you!


Here is the image produced showing the matchedfeatures

currentfolder = 'C:\Users\owen\Google Drive\Programming\Matlab\New folder'
pandaDir = fullfile(currentfolder);
pandaImg = imageSet(pandaDir);
montage(pandaImg.ImageLocation);
I = read(pandaImg,1); %assign the first image to variable I;
B = read(pandaImg,2);
I1 = rgb2gray(I);
B1 = rgb2gray(B);
points1 = detectHarrisFeatures(I1); %finds the corners
points2 = detectHarrisFeatures(B1);
[features1, valid_points1] = extractFeatures(I1,points1);
[features2 valid_points2] = extractFeatures(B1,points2);
indexPairs = matchFeatures(features1,features2);
matchedPoints1 = valid_points1(indexPairs(:,1),:);
matchedPoints2 = valid_points2(indexPairs(:,2),:);
figure; showMatchedFeatures(I1,B1,matchedPoints1,matchedPoints2);
blender = vision.AlphaBlender('Operation', 'Binary mask', ...
'MaskSource', 'Input port');
0 件のコメント
回答 (2 件)
Ahmet Cecen
2016 年 5 月 9 日
Seems like you have the indices of the matched features in both images. If you are certain no rotation is required, then you can simply do something like:
CompositeImage=[Image2(:,YCOORDINATEOFAMATCHEDFEATUREORPIXELinIMAGE2) Image1(:,YCOORDINATEOFTHESAMEMATCHEDFEATUREORPIXELinINAGE1:end) ]
2 件のコメント
Ahmet Cecen
2016 年 5 月 9 日
編集済み: Ahmet Cecen
2016 年 5 月 9 日
Haha my bad, this ij and xy inversion for images gets me sometimes. It is indeed the x coordinate, or j.
I haven't used this toolbox myself, but from the documentation, it looks like matchedPoints1 stores the corner points on Image1 and matchedPoints2 store the corresponding corner points on Image2. So:
matchedPoints1.Location(pointnumber,1)
will give the x location of a point in Image1, then:
matchedPoints2.Location(pointnumber,1)
will give the same point on the other. There may be some rounding issues. Keep in mind though you access and image array as:
Image(y,x)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!