将两个图像互相叠加。

5 views (last 30 days)
Tan
Tan on 28 Jun 2021
Hi, I am quite new to MATLAB and not very familiar with how imregtform, imwarp, and whether I should have used " affine" or "similarity/rigid" 来实现我的目标。
I am trying to superimpose my movingRegistered image directly on top of my fixed image, but this is the outcome that I get :
I can't get my movingRegistered image to translate directly to the top of my fixed image.
Would switching my approach from intensity-based registration to control point registration/feature detection and matching be the better approach?
This is my code that I am currently using:
functionmyfunc()
clear;
clc;
cla;
closeall
fixed = image_resizing(“ test1.1.jpg”);
moving = image_resizing("test2.1.JPG");
fixed = rgb2gray(fixed);
moving = rgb2gray(moving);
固定= imresize(固定,0.6,,'AntiAliasing', true);
moving = imresize(moving, 0.6,'AntiAliasing',true);
[optimizer, metric] = imregconfig('monomodal');
optimizer.MinimumStepLength = 5e-6;
optimizer.MaximumIterations = 300;
tform = imregtform(moving, fixed,'affine', optimizer, metric,“展示式化”,错误的);
movingRegistered = imwarp(moving,tform,'OutputView',imref2d(size(fixed)));
imshowpair(fixed, movingRegistered,“缩放”,'joint')
end
These are my two images that I would be using : &
非常感谢你的帮助!
1 Comment
Walter Roberson
Walter Roberson on 1 Jul 2021
In some recent work I was doing, I found that using Phase Correlation worked much better than any of the other ones I tested.

Sign in to comment.

Answers (1)

Bjorn Gustavsson
Bjorn Gustavsson on 1 Jul 2021
If your images are of equal size you can put them into different RGB-layers. Something like this:
合并(::,:,3)=固定;
merged(:,:,1) = movingRegistered;
这应该为您提供固定的图像为蓝色,并将移动为红色。您可能需要检查数据类型(如果两倍,则需要标准化 merged to 0-1).
HTH

Community Treasure Hunt

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

开始狩猎!

Translated by