void proccesFrame(Bitmap image, Action <IKeeper <Blob, double, double, AForge.Point>, IEnumerable <Blob> > action) { Bitmap rawImage = image; Bitmap processedImage = processImage(rawImage); IEnumerable <Tuple <string, Blob> > blobsWithTags = blobCounter.CountItems(processedImage); blobKeepers.ForEach(blobKeeper => action(blobKeeper, from blobWithTag in blobsWithTags where blobKeeper.Tag == blobWithTag.Item1 select blobWithTag.Item2)); DisplayControl.crossThreadOperation(() => { switch ((string)DisplayControl.SelectedItem) { case "Raw image": highlightBlobs(rawImage); break; case "Processed": highlightBlobs(processedImage); break; case "None": default: break; } }); videoGroupBox.crossThreadOperation(() => videoGroupBox.Text = $"Video - {pictureGiver.Tag}: {progressMessage}"); }