Help with multivariable optimization function

1 view (last 30 days)
Hello, I'm new to MATLAB and programming in general, so excuse my ignorance. I'm working on an optimization function that maximizes correlation between images by changing rotation and scale along with displacement. I don't have MATLAB's Optimization Toolbox but I do have the Image Processing Toolbox. I'm using the fminsearch function, but I don't know how to factor in multiple variables. Please review my code so far and let me know what I need to change and how so.
function corr= corrfun2(factors)
image1= imread('grid1.jpg');
image2= imread('grid2.jpg');
scale=factors(1)
rotate=factors(2)
corr= 1-normxcorr2(image1(100:200,200:300),imrotate(imresize(image2,scale),rotate));
[val,index]=min(corr);
[peakcorr,row]=min(val)
column=index(row)

Answers (0)

Categories

Find more on Get Started with Optimization 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!