/// <summary>Filters tracklets dependent on a <paramref name="Detection"/> from the list.</summary> private void Filter(ImageDetection Detection) { for (int i = 0; i < CurrentTracklets.Count; i++) { if (CurrentTracklets[i].Detections.Contains(Detection) && CurrentTracklets[i].Detections.Length == 3) { CurrentTracklets.RemoveAt(i); i--; } } RefreshTrackletList(); }
/// <summary> /// Filters detections matching a condition. /// </summary> /// <param name="Detection">Model detection.</param> /// <param name="Filter">Filtering predicate.</param> /// <param name="Parameter">Predicate parameter.</param> private void FilterByDetection(ImageDetection Detection, DetectionFilteringCondition Filter, double Parameter) { for (int i = 0; i < CurrentTracklets.Count; i++) { if (CurrentTracklets[i].Detections.Any((x) => Filter(Detection, x, Parameter))) { if (CurrentTracklets[i].Detections.Length == 3) { CurrentTracklets.RemoveAt(i); i--; } else { var r = CurrentTracklets[i].Detections.Where((x) => !Filter(Detection, x, Parameter)).ToArray(); if (r.Length < 3) { CurrentTracklets.RemoveAt(i); } } } } RefreshTrackletList(); }