public void StartAnalyzingPhotos(TreatmentPhotos treatmentPhotos)
        {
            var photoCount = listPhotos.Count;

            Utilities.debugmessage("Analyze Photo Thread STARTED!");

            do
            {
                if (!analyzePhotoStarted)
                {
                    analyzePhotoStarted = true;
                    var path = listPhotos[trPhoto];
                    nameFile = path;

                    cap = VideoCapture.FromFile(path);
                    Mat photoFrm = new Mat();
                    cap.Read(photoFrm);

                    AnalyzePhoto(photoFrm);

                    trPhoto++;
                    GC.Collect();

                    treatmentPhotos.Invoke(new Action(() =>
                    {
                        treatmentPhotos.lblStatus.Text = "Treatment photo...";
                        treatmentPhotos.lblCount.Text  = "Photo: " + trPhoto + "/" + photoCount;
                    }));
                }
            } while (trPhoto < photoCount);
            Utilities.debugmessage("Analyze Photo Thread FINISHED!");
        }
 public void formShow()
 {
     treatmentPhotos = new TreatmentPhotos();
     treatmentPhotos.Show();
     treatmentPhotos.Invoke(new Action(() => {
         treatmentPhotos.lblStatus.Text = "Start treatment photos...";
         treatmentPhotos.lblCount.Text  = "Photo: 0/" + countPhotos;
     }));
 }