lsqnonlin and rotation problem

1 次查看(过去 30 天)
chaton
chaton 2012-8-13
评论: AD 2021-5-11
Hello,
i'm sorry for this basic question but i have some problems with lsqnonlin and image registration. I want to use lsqnonlin in order to find the rotation (just the rotation because it's a study case) whish has been applied to a reference image. I use direct registration method comparing the intensity of the two images (reference and rotated image).
basically the pseudo code looks like that:
% load reference image % apply a rotation to the reference image im2 = imrotate(imref,23,'bicubic','crop');
% roiCmp is the subarea of the reference image which is considered for comparing intensity beetween ref and im2 guessValue = [10]; [afrotation,resNorm,residual,exitFlag] = lsqnonlin(@fitRot, guessValue, [], [], options,imref,im2, roiCmp);
%% The function fitRot use imrotate to rotate im2: function err = fitRot(x0,ref,tar,roiCmp)
rTrg = imrotate(sTrg,x0(3),'bicubic','crop');
overallRes = abs(double(rTrg) - double(ref));
resTemp = abs(overallRes(roiComp(2):roiComp(2)+roiComp(4),roiComp(1):roiComp(1)+roiComp(3)));
res = resTemp(:);
end
When i run this algorithm, it obtain the same result as my initial guess. I have no warning or error message and their is 3 step of optimisations but no change ...
Any help will be appreciate. Thx all (i hope to be clear and again sorry for this basic question)

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geometric 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