Experiments with lsqnonlin for rotation param estimation

1 visualización (últimos 30 días)
AD
AD el 15 de Nov. de 2020
Editada: AD el 15 de Nov. de 2020
Hi,
I am doing experiments with lsqnonlin function because it looks like a powerful and interesting tool.
I used it to solve some optimization problem (deconvolution) just to try - and it worked (although there are better or simpler methods with matrix inversion pseudoinverse or something to solve this kind of linear problem but it was just to try something).
But when I tried to following (see my code below) I noticed that it doesnt find the rotation angle and seem to just output the same x as I gave him (with very minor rotation maybe 1.5 degrees whereas I gave an y with 20 degrees) .
Note that x is the ground truth image (no rotation) and y is the image with rotation see full code below)
any idea why it does not work with rotation? (Although I know there are other methods for estimating params like re-alignment algorithms but the goal here is to have fun with lsqnonlin )
full function code so you can try it yourself:
function lsq_rec_estimRot_withReg(x,y,maxIterArg)
fun = @(theta) reshape(imrotate(x,theta,'crop')-y,[],1);
theta0 = randn();%initial guess
lsqnonlinoptions=optimset('Algorithm','Levenberg-Marquardt','MaxIter',maxIterArg);
theta_hat =lsqnonlin(fun,theta0,[],[],lsqnonlinoptions);
%% disp inside func for now
figure;
subplot(131);
imshow(x);
title('x');
subplot(132);
imshow(y);
title('y');
subplot(133);
imshow(imrotate(x,theta_hat,'crop'));
title(['x_{hat}, rot angle:' num2str(theta_hat) ] );
end

Respuestas (0)

Categorías

Más información sobre Inertias and Loads en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by