Image registration with Gradient descent and SSD

3 views (last 30 days)
[EDIT: 20110513 10:12 CDT - reformat - WDR]
I am trying to register two images based on gradient descent and sum square difference between two images. however, i have problem to update my transform matrix in each iteration. it can update translation but when i add rotation it just cant provide any correct results.
the following code is belongs to gradient descent with respect to translation and rotation:
[gy gx]=gradient(registerimage);
dx=sum(2*(gx(:)).*(referenceimage-registerimage(:)));
dy=sum(2*(gy(:)).*(referenceimage-registerimage(:)));
for i=1:128 (pixel position of registered image)
for j=1:128
Ir(i,j)=((-j)*gx(i,j))+(i*gy(i,j));
end
end
dr=sum(2*(Ir(:)).*(referenceimage-registerimage(:)));
after finding these gradient decent the following code has been used in order to update translation part of transform matrix:
trans(1,3)=trans(1,3)+currentStepSize*dx/lenght;
trans(2,3)=trans(2,3)+currentStepSize*dy/lengh
at the beginning of program transform matrix defined as eye(3), current step size (learning rate of gradient) is define as 0.5 but it will increase or decrease by factor of 2 based on the results of each iteration
and length is:
lenght=sqrt(dx^2+dy^2);
Now i have problem to change trans(1,1),trans(1,2),trans(2,1) and trans(2,2) which are belong to rotation part. i will be glad to have your comments on it because i really stuck.
Thanks

Answers (3)

Sean de Wolski
Sean de Wolski on 13 May 2011
I would recommend getting the brute force SSD criteria working first. Worry about optimizing (i.e. gradient descent) later.
Also, look at using the normalized SSD or zero-normalized SSD instead of just SSD. The small cost in computation time makes the criteria robust to illumination offsets and scales.
  1 Comment
amir yavari
amir yavari on 13 May 2011
the code is working perfectly for translation but i just dont know how to update my rotation. that is the problem for now and after that i will start to improve the code step by step. however i dont need to improve it so much becuase i need to know just what does gradient do for now.

Sign in to comment.


Walter Roberson
Walter Roberson on 13 May 2011
I would start by rewriting the code so that it does not use variables "lenght" and "lengh" that are confusingly like the MATLAB function "length". How is a reader of the code intended to quickly know the different meanings of those?

amir yavari
amir yavari on 13 May 2011
thanks guys but non of those information solve my problem. i need a formula to update my rotation matrix.

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!