Example #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.");
            }
        }
Example #2
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.");
     }
 }
Example #3
0
 public PrewittKernel(IApplicableFilter decoratingKernel, Direction compass)
     : base(decoratingKernel, 3, 3, PrewittKernel.constructWeights(3, 3, compass))
 {
     // What's the heading capt'n?
 }