Configurations for intensity-based registration
Load the images into the workspace and display them.
fixed = imread('pout.tif'); moving = imrotate(fixed, 5, 'bilinear', 'crop'); imshowpair(fixed, moving,'Scaling','joint');
Create the optimizer and metric. The two images in this example were captured on the same device, so we'll set the modality to'monomodal'.
[optimizer, metric] = imregconfig('monomodal')
optimizer = registration.optimizer.RegularStepGradientDescent Properties: GradientMagnitudeTolerance: 1.000000e-04 MinimumStepLength: 1.000000e-05 MaximumStepLength: 6.250000e-02 MaximumIterations: 100 RelaxationFactor: 5.000000e-01 metric = registration.metric.MeanSquares This class has no properties.
Pass optimizer and metric to imregister to perform the registration.
movingRegistered = imregister(moving,fixed,'rigid',optimizer, metric);
View the registered images
figure imshowpair(fixed, movingRegistered,'Scaling','joint');
Images captured on the same device. Monomodal images have similar brightness ranges.
Images captured on different devices. Multimodal images usually have different brightness ranges.
Your registration results can improve if you adjust the optimizer or metric settings. For example, if you increase the number of iterations in the optimizer, reduce the optimizer step size, or change the number of samples in a stochastic metric, the registration improves to a point, at the expense of performance.
imregister | imshowpair | registration.metric.MattesMutualInformation | registration.metric.MeanSquares | registration.optimizer.OnePlusOneEvolutionary | registration.optimizer.RegularStepGradientDescent