Пример #1
0
        internal static Bitmap Run(Bitmap bitmap, AlgorythmChoices alg, LibraryChoices lib, int threadsNo)
        {
            if (bitmap == null)
            {
                return(null);
            }
            if (threadsNo < 1 || threadsNo > 64)
            {
                return(null);
            }

            LaPalaceFilter filter = new LaPalaceFilter(bitmap, alg, lib, threadsNo);

            return(filter.RunParallel());
        }
Пример #2
0
        /// <summary>
        /// Private constructor invoked by "Run" method.
        /// </summary>
        /// <param name="bitmap">Source image</param>
        /// <param name="algorythm">Enum indicating which LaPlace algorythm will be used</param>
        /// <param name="library">Enum saying which library will be used (C or ASM)</param>
        /// <param name="threadsNo">Number of pieces in which input image will be split and calculated paralelly</param>
        private LaPalaceFilter(Bitmap bitmap, AlgorythmChoices alg, LibraryChoices lib, int threadsNo)
        {
            this.threadsNo = threadsNo;
            this.library   = lib;
            this.input     = bitmap;
            switch (alg)
            {
            case AlgorythmChoices.LAPL1: pattern = LAPL1; break;

            case AlgorythmChoices.LAPL2: pattern = LAPL2; break;

            case AlgorythmChoices.SHARPEN: pattern = SHARPEN; break;

            case AlgorythmChoices.DIAG: pattern = DIAG; break;

            case AlgorythmChoices.HORIZ: pattern = HORIZ; break;

            case AlgorythmChoices.VERTIC: pattern = VERTIC; break;
            }
        }