Exemplo n.º 1
0
        private void ConstructKernels(CompassType type)
        {
            int i = 0;

            kernels = new BasicKernel[8];
            switch (type)
            {
            case CompassType.Approximation:
                foreach (Direction compass in Enum.GetValues(typeof(Direction)))
                {
                    kernels[i] = new ApproximationKernel(null, compass);
                    i++;
                }
                break;

            case CompassType.Isotropic:
                foreach (Direction compass in Enum.GetValues(typeof(Direction)))
                {
                    kernels[i] = new IsotropicKernel(null, compass);
                    i++;
                }
                break;

            case CompassType.Kirsch:
                foreach (Direction compass in Enum.GetValues(typeof(Direction)))
                {
                    kernels[i] = new KirschKernel(null, compass);
                    i++;
                }
                break;

            case CompassType.Prewitt:
                foreach (Direction compass in Enum.GetValues(typeof(Direction)))
                {
                    kernels[i] = new PrewittKernel(null, compass);
                    i++;
                }
                break;

            case CompassType.Sobel:
                foreach (Direction compass in Enum.GetValues(typeof(Direction)))
                {
                    kernels[i] = new SobelKernel(null, compass);
                    i++;
                }
                break;

            default:
                throw new InvalidOperationException("You cannot perform a CompassOperation on the specified CompassType.");
            }
        }
Exemplo n.º 2
0
 public SobelKernel(IApplicableFilter decoratingKernel, Direction compass)
     : base(decoratingKernel, 3, 3, SobelKernel.constructWeights(3, 3, compass))
 {
     // A 'jiffy' is an actual unit of time for 1/100th of a second
 }
Exemplo n.º 3
0
 private void ConstructKernels(CompassType type)
 {
     int i = 0;
     kernels = new BasicKernel[8];
     switch (type)
     {
         case CompassType.Approximation:
             foreach (Direction compass in Enum.GetValues(typeof(Direction)))
             {
                 kernels[i] = new ApproximationKernel(null, compass);
                 i++;
             }
             break;
         case CompassType.Isotropic:
             foreach (Direction compass in Enum.GetValues(typeof(Direction)))
             {
                 kernels[i] = new IsotropicKernel(null, compass);
                 i++;
             }
             break;
         case CompassType.Kirsch:
             foreach (Direction compass in Enum.GetValues(typeof(Direction)))
             {
                 kernels[i] = new KirschKernel(null, compass);
                 i++;
             }
             break;
         case CompassType.Prewitt:
             foreach (Direction compass in Enum.GetValues(typeof(Direction)))
             {
                 kernels[i] = new PrewittKernel(null, compass);
                 i++;
             }
             break;
         case CompassType.Sobel:
             foreach (Direction compass in Enum.GetValues(typeof(Direction)))
             {
                 kernels[i] = new SobelKernel(null, compass);
                 i++;
             }
             break;
         default:
             throw new InvalidOperationException("You cannot perform a CompassOperation on the specified CompassType.");
     }
 }