public CoorespondenceSolver(TanSolver tanSolver, CorresponencePoint point, double width, double height) { this.width = width; this.height = height; this.point = point; ts = tanSolver; }
private WcsSolution SolveLM() { Vector2d temp = Points[0].Image - Points[1].Image; double imageLength = temp.Length; double angularSperation = CAAAngularSeparation.Separation(Points[0].Celestial.RA, Points[0].Celestial.Dec, Points[1].Celestial.RA, Points[1].Celestial.Dec); // Degrees per pixel double scale = angularSperation / imageLength; WcsSolution sinit = Solve(Points[0], Points[1]); TanSolver ts = new TanSolver(sinit.CenterX, sinit.CenterY, sinit.Rotation - 180, sinit.Scale); foreach (CorresponencePoint cp in Points) { SolveList.Add(new CoorespondenceSolver(ts, cp, width, height)); } regressionParameters.AddRange(ts.Parameters); int count = SolveList.Count; double[,] data = new double[2, count]; for (int i = 0; i < count; i++) { data[0, i] = i; data[1, i] = 0; } Parameter[] observed = new Parameter[] { ParmeterIndex }; lm = new LevenbergMarquardt(new functionDelegate(SolveFunction), regressionParameters.ToArray(), observed, data); for (int d = 0; d < 50; d++) { lm.Iterate(); } WcsSolution s = ts.GetSolution(); s.OffsetX = width / 2; s.OfsetY = height / 2; return(s); }
private WcsSolution SolveLM() { Vector2d temp = Points[0].Image - Points[1].Image; double imageLength = temp.Length; double angularSperation = CAAAngularSeparation.Separation(Points[0].Celestial.RA, Points[0].Celestial.Dec, Points[1].Celestial.RA, Points[1].Celestial.Dec); // Degrees per pixel double scale = angularSperation / imageLength; WcsSolution sinit = Solve(Points[0], Points[1]); TanSolver ts = new TanSolver(sinit.CenterX, sinit.CenterY, sinit.Rotation-180, sinit.Scale); foreach (CorresponencePoint cp in Points) { SolveList.Add(new CoorespondenceSolver(ts, cp, width, height)); } regressionParameters.AddRange(ts.Parameters); int count = SolveList.Count; double[,] data = new double[2, count]; for (int i = 0; i < count; i++) { data[0, i] = i; data[1, i] = 0; } Parameter[] observed = new Parameter[] { ParmeterIndex }; lm = new LevenbergMarquardt(new functionDelegate(SolveFunction), regressionParameters.ToArray(), observed, data); for (int d = 0; d < 50; d++) { lm.Iterate(); } WcsSolution s = ts.GetSolution(); s.OffsetX = width / 2; s.OfsetY = height / 2; return s; }