Ejemplo n.º 1
0
 public static void ReduceSmudgesHSV()
 {
     if (ImageBefor != null)
     {
         using (Smudge smudge = new Smudge(ImageBefor))
         {
             ImageAfter = smudge.CleanHSV();
         }
     }
 }
Ejemplo n.º 2
0
        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();
                            }
                        }
                    }
                }
            }
        }