# Correctly set up FindMinimum

I am trying to setup the following minimization to align two astronomical images.

scfac =
FindMinimum[
Log[AlignCriterion3[imTargetFM*SC, imRefFiltFM*SC, alpha]], {alpha, 1},
PrecisionGoal -> 6, AccuracyGoal -> 10];


where,

AlignCriterion3[im_, imRef_, scfac_] :=
Plus @@ Plus @@ ((im - ImRescale[imRef, scfac])^2)


and

ImRescale[Im_, ScFac_] :=
Module[{n, res},
n = Dimensions[Im][[1]];
Print[ScFac];
res = Resize[ImageData[ImageResize[Image[Im], {n*ScFac, n*ScFac}]], n]
]


Clearly, I do not know how to setup the FindMinimum since I keep getting the following error:

ImageResize::imgrssz: The size {120 alpha,120 alpha} is not a valid image size specification.

How do I set it up so that the value of alpha is actually passed to the Rescaling code I've written.

Example of an image that I am trying to align. I have the x & y shifts pegged down pretty accurately - the idea is to scale the image size to try and fix what I think is some kind of scale based alignment issue.

-
Seriously bad idea using uppercase initials for symbols, e.g. Im is an MMA symbol. Please update your query with sample images, so readers need not imagine what's going on in their heads... –  rasher Feb 26 at 2:11
Have you tried FindGeometricTransform[]? –  belisarius Feb 26 at 3:29
I can't try without a sample image, so this is just a guess: Did you try restricting the scfac parameter to ?NumericQ (see here: mathematica.stackexchange.com/questions/18393/…). Also, you should probably Round the size parameter to ImageResize –  nikie Feb 26 at 7:08