1
votes

I'm trying to use `imregister? to align two images. I went through the MATLAB tutorial and have been searching for the error I'm receiving but can't find anything.

Input:

movingRegistered = imregister(moving, fixed, 'affine', optimizer, metric);

This is the error

Error using imregtform>parseInputs (line 252) The value of 'MovingImage' is invalid. All dimensions of the moving image should be greater than 4.

Error in imregtform (line 123) parsedInputs = parseInputs(varargin{:});

Error in imregister (line 119); tform = imregtform(varargin{:});"

Thanks for any help

2

2 Answers

3
votes

Your have to use grayscale images or a single channel for imregister to work.

eg:

movingRegistered = imregister(rgb2gray(moving), rgb2gray(fixed), 'affine', optimizer, metric);

or else

movingRegistered = imregister(moving(:,:,Channel), fixed(:,:,Chanel), 'affine', optimizer, metric);
0
votes

moving_reg = imregister(moving,fixed,transformType,optimizer,metric) transforms the 2-D or 3-D image, moving, so that it is registered with the reference image, fixed. Both moving and fixed images must be of the same dimensionality, either 2-D or 3-D. transformType is a character string that defines the type of transformation to perform. optimizer is an object that describes the method for optimizing the metric and metric is an object that defines the quantitative measure of similarity between the images to optimize. You can find more detail and code example here.