MATLAB Answers

Image Registration step by step

18 views (last 30 days)
rob on 31 Oct 2013
I want to add my own transformation type for an image registration(differing from affine or rigid). Does anyone have step by code for registration in which this is possible? Also i had like to implement my own similarity measure. Tips or code anyone? It is for contourtracking in greyscale images.

Accepted Answer

rob on 31 Oct 2013
Well I am first sampling along a contour on my fixed image. All the moving images are also sampled on this contour. This ensures that in theory the contour that i want to track is only moving vertically. So in the registration it is not really affine because there is out of plane motion. But there is not enough out of plane resolution to use 3D registration. It is a time series. So optic flow might be an option. I am using the b-spline model at this point but i need to make a grid which moves in the way i want it to(other constrictions). Or i need to adjust the affine transformation in such a way that it only registers vertical shifts and does not do anything horizontally(x direction)
rob on 31 Oct 2013
Thank you! I will look into it and hopefully understand it. Ok if otherwise i post questions here?

Sign in to comment.

More Answers (4)

Matt J
Matt J on 31 Oct 2013
Edited: Matt J on 31 Oct 2013
yes but i'd like to see a basic code on how to do this.
The most basic way you could implement your own SSD registration is as follows.
fun=@(parameters) ssd(imtransform(Image1,...more arguments...) -Image2);
transformParameters = fminsearch(fun,options);
If you have many parameters (more than 6), you won't get very robust convergence with fminsearch. You could instead use a solver in the Optimization Toolbox if you have it. In the latter case, though, you should be careful to apply imtransform with spline interpolation, since the cost function needs to be differentiable.
The Optimization Toolbox solvers could be somewhat slow if you let them use finite difference derivative calculations (the default). You can supply your own cost function gradient computation, with some work using custom interpolants in MAKERESAMPLER.
  1 Comment
rob on 31 Oct 2013
thank you for a constructive answer, i am going to look into this!

Sign in to comment.

Image Analyst
Image Analyst on 31 Oct 2013
You're free to write your own customized function that registers images according to any wild and crazy function that you want. How can I have step by step code for doing some kind of registration for some unknown method? You must have something in mind because you clearly don't like any of the built in methods, so just go for it.
rob on 31 Oct 2013
well i don't want an affine i want in the x direction to search the new y coordinates on a composition of sines and cosines.

Sign in to comment.

Alex Taylor
Alex Taylor on 31 Oct 2013
Edited: Alex Taylor on 31 Oct 2013
I would just add a few things:
1) Can you elaborate on what kind of transform model you want to use instead of rigid? Are you trying to do some sort of deformable model registration?
2) What kind of similarity model do you want to use?
3) Is the transformation model that you want to use provided by imregister/imregtform? imregister and imregtform implement sum of square differences and Mutual Information as similarity metrics and offer translation, rigid, similarity, and affine transformation models?
4) Note that in Matt's answer, if the type of transformation you want to use isn't supported by any of the built-in transformations in maketform, you are going to need to use the 'custom' option in maketform to define your own custom geometric transformation.

Ibraheem Al-Dhamari
Ibraheem Al-Dhamari on 9 Jul 2015
Check this! it is a code from a PhD thesis in registration.

Community Treasure Hunt

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

Start Hunting!