Image registration with Gradient descent

6 ビュー (過去 30 日間)
amir yavari
amir yavari 2011 年 5 月 12 日
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 begining 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 becuase i really stuck.
Thanks
  2 件のコメント
Sean de Wolski
Sean de Wolski 2011 年 5 月 12 日
Could you please reformat your post to make it readable. (See markup help)
amir yavari
amir yavari 2011 年 5 月 12 日
hi sorry for writing badly. i am now just trying to sort out this gradient decent problem and i can not concentrate well. sorry if something is not clear.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2011 年 5 月 12 日
Did you really code a variable named "lengh" and another named "lenght", both of which are confusingly close to the name of the built-in function "length" ?
  1 件のコメント
Walter Roberson
Walter Roberson 2011 年 5 月 12 日
Did changing the variable names solve your difficulty?

サインインしてコメントする。

その他の回答 (1 件)

Sean de Wolski
Sean de Wolski 2011 年 5 月 12 日
The for-loop can be vectorized with
Ir = bsxfun(@times,gx,-(1:128))+bsxfun(@times,gy,-(1:128).');

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by