public static void ReduceSmudgesBGR()
 {
     if (ImageBefor != null)
     {
         using (Smudge smudge = new Smudge(ImageBefor))
         {
             ImageAfter = smudge.CleanSmudges();
         }
     }
 }
        public static void AutomaticRepair(bool dust, bool scratches, bool smudges)
        {
            int steps = 0;

            steps = dust ? steps + 1 : steps;
            steps = scratches ? steps + 1 : steps;
            steps = smudges ? steps + 1 : steps;
            steps = (scratches || smudges) ? steps + 1 : steps;
            ProgressManager.AddSteps(steps);

            if (ImageBefor != null)
            {
                if (smudges)
                {
                    //Progress 9 steps
                    using (Smudge smudge = new Smudge(ImageBefor))
                    {
                        ImageAfter = smudge.CleanSmudges();
                    }
                }

                if (dust || scratches)
                {
                    using (DefectsFinder defectsFinder = new DefectsFinder(ImageBefor))
                    {
                        //Progress 8 steps
                        defectsFinder.SearchDefects();
                        if (dust)
                        {
                            using (Dust dustCleaner = new Dust(ImageAfter, defectsFinder.SmallDefectsContoursMatrix, _exclFromCleaning))
                            {
                                //Progress 100 steps
                                ImageAfter = dustCleaner.DustReductionLeftToRight();
                            }
                        }

                        if (scratches)
                        {
                            using (Scratches scratchesCleaner = new Scratches(ImageAfter, defectsFinder.LargeDefectsContoursMatrix, _exclFromCleaning))
                            {
                                //Progres scratches count
                                ImageAfter = scratchesCleaner.RemoveScrates();
                            }
                        }
                    }
                }
            }
        }