# how can i perform a registration to 2D images using ''rigid " transformation in matlab?

i need to perform registration to 2D image using"rigid transformation" in matlab .i need this for measuring the similarity between my images .any one know how this can be done using matlab?

an example on my images :

regards

• Please post the image(s) you want to register. – Maurits Feb 13 '12 at 22:45
• If you have the image processing toolbox, then go to the documentaion Image processing Toolbox>User's Guide>Image Registration. This is thoroughly documented. – yohbs Feb 14 '12 at 8:14
• @Maurits .....edition done and link on my image was added.thanks. – ruaa Feb 14 '12 at 10:09
• @yohbs . thanks in advance , but i still need many additional things to this matlab illustration – ruaa Feb 14 '12 at 10:11
• That is a single image. You need two, at least. And please, embed them. – Maurits Feb 14 '12 at 10:33

A rigid, or isometrie transformation, is a transformation in which the distances between the points that are transformed, are preserved. This means that an object formed by these points will have the same shape and size after transformation. Examples are rotations and translations.

A 2D column vector can be rotated by $\theta$ as follows:

$\left(\begin{array}{c}x' \\ y'\end{array}\right) = \left ( \begin{array}{cc} \cos \theta & - \sin \theta \\ \sin \theta & \cos \theta \end{array} \right ) \left(\begin{array}{c}x \\ y\end{array}\right)$

In your case you will probably be seeking a combination of rotation and translation between two images meaning that the relation between the points of these images can be defined as follows:

$\left(\begin{array}{c}x' \\ y' \\ 1\end{array}\right) = \left ( \begin{array}{ccc} \cos \theta & - \sin \theta & t_x\\ \sin \theta & \cos \theta & t_y \\ 0 & 0 & 1 \end{array} \right ) \left(\begin{array}{c}x \\ y \\1\end{array}\right)$

Or short:

$\textbf{x}' = \textbf{A}\textbf{x}$

This particular transformation has 3 degrees of freedom, one for rotation and two for translation. This means that you can solve this matrix for 2 point correspondences $\{ \textbf{x}' \leftrightarrow \textbf{x} \}$. That means in your case that you need two points in the original image and two matching points in the distorted image to ascertain the translation and rotation between them.

Ultimate reference: Multiple View Geometry

EDIT

The deformation between these images is obviously not an isometrie. For one the branches appear and disappear between them. I played a little with a slightly more involved form of feature based registration based on the assumption that the distortion is a similarity transform with 4 degrees of freedom, and the features will make up for the difference in edges. In short:

• SIFT feature detection and matching
• RANSAC estimation to detect inliers
• Direct Linear Transform (DLT) variant for estimation of scale and rotation
• Run of the mill cross correlation to detect the translation

Results, not brilliant, but here goes

All code on Github, demo file is so_13_02_2012.m.

• please Maurits . can you give me more illustration . because it is obvious that you have good knowledge in computer vision. i am just new bie to this field .can you give me simpler explanation? – ruaa Feb 13 '12 at 15:11
• what is the difference between original and registered images that you posted in your edition.what is your proposal? ,which method may be more suitable to give me specific result in matching my images? . wait your reply if you can ,please. – ruaa Feb 20 '12 at 11:08

For translation only you can use a simple phase correlation technique which is trivial to implement in Matlab.

This can be extended to include rotation and scaling as well by moving to log-polar coordinates (see the links off of the Wikipedia page).

• Maurits .....edition done and link on my image was added.thanks. – ruaa Feb 14 '12 at 10:06