/// <summary> /// Recovers the tracklet on a given set of images (typically pipeline input ones). /// </summary> /// <returns><c>true</c>, if tracklet was recovered, <c>false</c> otherwise.</returns> /// <param name="tvr"><see cref="TrackletVelocityRegression"/> from which the positions are computed.</param> /// <param name="InputImages">Images on which to perform the recovery.</param> /// <param name="Recovered">Recovered tracklet.</param> public bool RecoverTracklet(TrackletVelocityRegression tvr, IEnumerable <Image> InputImages, out Tracklet Recovered) { List <ImageDetection> Detections = new List <ImageDetection>(); foreach (Image img in InputImages) { /* Compute location */ ObservationTime obTime = img.GetProperty <ObservationTime>(); double Secs = (obTime.Time - tvr.ZeroTime).TotalSeconds; EquatorialPoint eqp = new EquatorialPoint() { RA = tvr.P_TR.Slope * Secs + tvr.P_TR.Intercept, Dec = tvr.P_TD.Slope * Secs + tvr.P_TD.Intercept }; Position p = new Position(eqp, img.Transform.GetPixelPoint(eqp)); /* Perform recovery */ if (RecoverDetection(p, img, RecoverRadius, InputImages, out ImageDetection RecD)) { Detections.Add(RecD); } } if (Detections.Count >= MinDetections) { Recovered = StandardTrackletFactory.CreateTracklet(Detections.ToArray()); return(true); } else { Recovered = null; return(false); } }
/// <summary> /// Pairs the sources into tracklets. /// </summary> /// <returns>The list of tracklets found by the algorithm.</returns> public override List <Tracklet> FindTracklets() { int i, j; CandidatePairings = new List <ImageDetection[][]>(); for (i = 0; i < PoolList.Count; i++) { /*if (PoolList[i].TryFetchProperty(out PairingProperties pp)) * if (pp.IsPaired) continue;*/ for (j = 0; j < PoolList.Count; j++) { if (PoolList[i].TryFetchProperty(out PairingProperties pp)) { if (pp.IsPaired) { if (PoolList[j].TryFetchProperty(out PairingProperties pp2)) { if (pp2.IsPaired) { continue; } } } } if (PoolList[i].Time.Time == PoolList[j].Time.Time) { continue; } if (VerifyPair(PoolList[i], PoolList[j])) { AnalyzePair(PoolList[i], PoolList[j]); } } } var Tracklets = CandidatePairings.Select((ImageDetection[][] x) => x.Where((y) => y.Length > 0).Select(StandardTrackletFactory.MergeStandardDetections).ToArray()) .Select((x) => StandardTrackletFactory.CreateTracklet(x)).ToList(); return(Tracklets); }