public void TryPairDot(ImageDetection a, ImageDetection b) { if (a.FetchProperty <PairingProperties>().IsPaired || b.FetchProperty <PairingProperties>().IsPaired) { return; } TimeSpan DeltaTime = b.Time.Time - a.Time.Time; var Line = b.Barycenter.EP - a.Barycenter.EP; double PairEstimatedDistance = ~Line; if (PairEstimatedDistance > MaxVDD * DeltaTime.TotalMinutes) { return; } if (PairEstimatedDistance < MinVDD * DeltaTime.TotalMinutes) { return; } double PairEstimatedDistanceError = 2 * (a.FetchProperty <ObjectSize>().PixelEllipse.SemiaxisMajor + b.FetchProperty <ObjectSize>().PixelEllipse.SemiaxisMajor); PairEstimatedDistanceError *= a.ParentImage.Transform.GetEstimatedWCSChainDerivative(); double PairEstimatedVelocity = PairEstimatedDistance / DeltaTime.TotalSeconds; double PairEstimatedVelocityError = PairEstimatedDistanceError / DeltaTime.TotalSeconds; List <List <ImageDetection> > DetectedInPool = new List <List <ImageDetection> >(); List <ImageDetection[]> DIPAr = new List <ImageDetection[]>(); foreach (DateTime dt in ObsTimes) { TimeSpan tsp = dt - b.Time.Time; double EstDistance = PairEstimatedVelocity * tsp.TotalSeconds; double EstDistError = Math.Abs(PairEstimatedVelocityError * tsp.TotalSeconds) + PairEstimatedDistanceError; EquatorialPoint EstimatedPoint = Line + EstDistance; var DetectionsList = DetectionPool.Query(EstimatedPoint.RA, EstimatedPoint.Dec, EstDistError); DetectionsList.RemoveAll((x) => ((x.Barycenter.EP ^ EstimatedPoint) > EstDistError) || (x.Time.Time != dt) || !x.FetchProperty <PairingProperties>().IsDotDetection); //DetectedInPool.Add(DetectionsList); DIPAr.Add(DetectionsList.ToArray()); } int i, c = 0; for (i = 0; i < DIPAr.Count; i++) { if (DIPAr[i].Length != 0) { c++; } } if (c >= 3) { CandidatePairings.Add(DIPAr.ToArray()); foreach (ImageDetection[] mdl in DIPAr) { foreach (ImageDetection m in mdl) { m.FetchProperty <PairingProperties>().IsPaired = true; } } } }
double ComputeWidth(ImageDetection Input) { double X0Angle = Input.FetchProperty <ObjectSize>().PixelEllipse.SemiaxisMajorAngle; /* Rotation matrix: { { Cos(-X0Angle), -Sin(-X0Angle) }, { Sin(-X0Angle), Cos(-X0Angle) } } */ double YSsum = 0, Ysum = 0; if (Input.TryFetchProperty(out ObjectPoints op)) { var pixelPoints = op.PixelPoints; foreach (PixelPoint pp in pixelPoints) { double nY = pp.Y * Cos(X0Angle) - pp.X * Sin(X0Angle); YSsum += nY * nY; Ysum += nY; } YSsum /= pixelPoints.Length; Ysum /= pixelPoints.Length; YSsum -= Ysum * Ysum; return(2 * Sqrt(YSsum)); } else { return(0); } }
/// <summary>Checks whether a pair of detections makes reasonable sense to become a candidate object.</summary> bool VerifyPair(ImageDetection a, ImageDetection b) { if (a.TryFetchProperty(out PairingProperties ppa) && b.TryFetchProperty(out PairingProperties ppb)) { if (ppa.StarPolluted | ppb.StarPolluted) { return(false); } } double ErrRad = MaxLinErrorArcSec * Math.PI / 180 / 3600; double MsizeLD = (a.FetchProperty <ObjectSize>().PixelEllipse.SemiaxisMajor + b.FetchProperty <ObjectSize>().PixelEllipse.SemiaxisMajor) * 2; MsizeLD *= a.ParentImage.Transform.GetEstimatedWCSChainDerivative(); double Mdistance = (a.Barycenter.EP ^ b.Barycenter.EP); double DeltaABTimeS = (b.Time.Time - a.Time.Time).TotalSeconds; double TExpTime = a.Time.Exposure.TotalSeconds + b.Time.Exposure.TotalSeconds; /* If the distance is too large for light sources too small, no need to check further */ if ((MsizeLD + ErrRad) * DeltaABTimeS < Mdistance * TExpTime) { return(false); } return(true); }
public bool PairPossible(ImageDetection a, ImageDetection b) { PairingProperties App = a.FetchOrCreate <PairingProperties>(), Bpp = b.FetchOrCreate <PairingProperties>(); if (App.IsPaired || Bpp.IsPaired) { return(false); } if (App.StarPolluted || Bpp.StarPolluted) { return(false); } if (a.Time.Time == b.Time.Time) { return(false); } TimeSpan DeltaTime = a.Time.Time - b.Time.Time; //if ((a.LargestDistance + b.LargestDistance) * Math.Abs(DeltaTime.TotalSeconds) < (a.Barycenter.EP ^ b.Barycenter.EP) * (a.Time.Exposure.TotalSeconds + b.Time.Exposure.TotalSeconds) / 2) return false; SourceEllipse aPel = a.FetchProperty <ObjectSize>().PixelEllipse, bPel = b.FetchProperty <ObjectSize>().PixelEllipse; if (aPel.SemiaxisMajor > LongTrailHighThreshold * LongTrailHighThreshold) { if (bPel.SemiaxisMajor < LongTrailLowThreshold * LongTrailLowThreshold) { return(false); } } double DeltaAngle = aPel.SemiaxisMajorAngle - bPel.SemiaxisMajorAngle; double Length = aPel.SemiaxisMajor + bPel.SemiaxisMajor; if (DeltaAngle * DeltaAngle * Math.Sqrt(Length) > AngleDistanceDifferenceThreshold) { return(false); } return(true); }
/// <inheritdoc/> public bool Filter(ImageDetection Input) => !(Input.FetchProperty <ObjectPhotometry>().Flux > BrightnessThreshold * Input.FetchProperty <ObjectPoints>().PixelPoints.Length&& Input.FetchProperty <ObjectSize>().PixelEllipse.SemiaxisMinor < ThicknessThreshold);