Registering two images where the camera has translated

3 views (last 30 days)
I have been trying to register some tif images of a vessel in the body so that I can then run imwarp and look 'into' the vessel perpendicularly, the problem is the camera that is taking pictures of these vessels 'jumps' at certain points to keep the vessel in view. I've attached two files (I saved them as jpg so that I could attach them) where such a view change occurs, it is a translation in the x direction, however using imregister with the 'translation' option does not seem to work, and leads to a 'did not converge error', and the 'affine' option leads to a rotation of viewing angle which is not what has actually occured. Here is the code I've been using I found it in some example documentation, in all honesty I have very little idea what the parameters optimizer and metric really are and what all the different attributes of optimizer do so if anyone could point me in the right direction that would be much appreciated.
[optimizer, metric] = imregconfig('multimodal');
fixed = imread('FIBSLICE0229.tif');
moving = imread('FIBSLICE0230.tif');
optimizer.InitialRadius = 0.01;
optimizer.Epsilon = 1.5e-4;
optimizer.GrowthFactor = 1.01;
optimizer.MaximumIterations = 300;
im_reg= imregister(moving,fixed,'translation',optimizer,metric);

Accepted Answer

Matt J
Matt J on 12 Sep 2021
Edited: Matt J on 12 Sep 2021
The default multi-modal options seem to work pretty well.
imreader=@(z,s) imresize(rgb2gray(imread(z)),s);
%Register at reduced pixel resolution
s=0.25;
fixed = imreader('FIBSLICE0229.jpg',s);
moving = imreader('FIBSLICE0230.jpg',s);
[optimizer, metric] = imregconfig('multimodal');
tform= imregtform(moving, fixed,'translation',optimizer,metric);
tform.T(3,1:2)=tform.T(3,1:2)/s;
%Apply transform at full resolution
s=1;
fixed = imreader('FIBSLICE0229.jpg',1);
moving = imreader('FIBSLICE0230.jpg',1);
im_reg = imwarp(moving,tform,'OutputView',imref2d(size(moving)));
imshowpair(fixed, im_reg,'falsecolor')

More Answers (0)

Community Treasure Hunt

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

Start Hunting!