private void ComputeDetectorData(FitsImage Central, ImageStatistics CentralStats, StarData StarList, out MaskByMedian.MaskProperties MaskProp, out DotDetector SlowDetector, out LongTrailDetector.LongTrailData LTD) { MaskProp = new MaskByMedian.MaskProperties() { LTM = MaskThreshold.Low, UTM = MaskThreshold.High, ExtraMaskRadius = ExtraMaskRadius, MaskRadiusMultiplier = MaskRadiusMultiplier, StarList = StarList }; MaskByMedian.CreateMasker(Central, MaskProp, CentralStats); SlowDetector = new DotDetector() { HighThresholdMultiplier = DotDetectorThreshold.High, LowThresholdMultiplier = DotDetectorThreshold.Low, MinPix = DotMinPix, NonrepresentativeThreshold = NonrepresentativeThreshold }; LTD = LongTrailDetector.GeneralAlgorithmSetup( PSFSize: PSFDiameter, RLHTThreshold: RLHTThreshold, SegmentSelectThreshold: SegmentThreshold.High, SegmentDropThreshold: SegmentThreshold.Low, MaxInterblobDistance: MaxInterblobDistance, SimpleLine: true); LTD.DropCrowdedRegion = true; }
/// <summary> /// Calibrate the zero point of the specified image. /// </summary> /// <returns>The Zero Point magnitude.</returns> /// <param name="Img">Image to calibrate.</param> /// <param name="Args">Calibration parameters.</param> /// <returns>The Zero Point magnitude.</returns> public static double CalibrateImage(Image Img, CalibrationArgs Args) { DotDetector StarDetector = new DotDetector() { HighThresholdMultiplier = Args.StarHighThreshold, LowThresholdMultiplier = Args.StarLowThreshold, MinPix = 15, NonrepresentativeThreshold = Args.NonRepThreshold }; StarDetector.Parameters.Xstep = 0; StarDetector.Parameters.Ystep = 200; var StList = StarDetector.DetectRaw(Img); var LocalStars = StList.Where((x) => x.Flux > Args.MinFlux & x.Flux < Args.MaxFlux).Where((x) => !x.PixelValues.Any((y) => y > Args.ClippingPoint)). Select((x) => new Star() { EqCenter = Img.Transform.GetEquatorialPoint(x.Barycenter), Flux = x.Flux, PixCenter = x.Barycenter }).ToList(); PixelPoint PixC = new PixelPoint() { X = Img.Width / 2, Y = Img.Height / 2 }; PixelPoint DiagF = new PixelPoint() { X = Img.Width, Y = Img.Height }; double Diag = Img.Transform.GetEquatorialPoint(new PixelPoint() { X = 0, Y = 0 }) ^ Img.Transform.GetEquatorialPoint(DiagF); EquatorialPoint EqCenter = Img.Transform.GetEquatorialPoint(PixC); List <StarInfo> RemoteStars = GetVizieRObjects(EqCenter, Diag / 2, Args.MaxVizierMag); for (int i = 0; i < RemoteStars.Count; i++) { for (int j = i + 1; j < RemoteStars.Count; j++) { if ((RemoteStars[i].Coordinate ^ RemoteStars[j].Coordinate) < Arc1Sec * Args.PositionError * DoubleStarRatio) { RemoteStars.RemoveAt(j); RemoteStars.RemoveAt(i); i--; break; } } } return(Calibrate(RemoteStars, LocalStars, Args.PositionError)); }