Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

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.

share|improve this question
2  
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.