/** * get the kernel for sigma. * * <p>To create the x-axis for the kernel: * * <pre> * int halfWidthInPixels = kernel.length >> 1; * int[] x = new int[kernel.length]; * for (int i = 0; i < x.length; i++) { * x[i] = i + (int) (mu - halfWidthInPixels); * } * </pre> * * @param sigma * @return */ public static float[] getKernel(SIGMA sigma) { if (sigma.ordinal() == SIGMA.ZEROPOINTFIVE.ordinal()) { return getBinomialKernelSigmaZeroPointFive(); } else if (sigma.ordinal() == SIGMA.ZEROPOINTSEVENONE.ordinal()) { return getBinomialKernelSigmaZeroPointSevenOne(); } else if (sigma.ordinal() == SIGMA.ONE.ordinal()) { return getBinomialKernelSigmaOne(); } else if (sigma.ordinal() == SIGMA.ONESQRT2.ordinal()) { return getBinomialKernelSigmaOneSQRT2(); } else if (sigma.ordinal() == SIGMA.ONEPOINTFIVE.ordinal()) { return getBinomialKernelSigmaOnePointFive(); } else if (sigma.ordinal() == SIGMA.TWO.ordinal()) { return getKernelSigmaTwo(); } else if (sigma.ordinal() == SIGMA.TWOSQRT2.ordinal()) { return getKernelSigmaTwoSQRT2(); } else if (sigma.ordinal() == SIGMA.THREE.ordinal()) { return getKernelSigmaThree(); } else if (sigma.ordinal() == SIGMA.FOUR.ordinal()) { return getKernelSigmaFour(); } else if (sigma.ordinal() == SIGMA.FOURSQRT2.ordinal()) { return getKernelSigmaFourSQRT2(); } else if (sigma.ordinal() == SIGMA.EIGHT.ordinal()) { return getKernelSigmaEight(); } else { return getKernel(SIGMA.getValue(sigma)); } }
protected static float[] getBinomialKernel(SIGMA sigma) { if (sigma.ordinal() == SIGMA.ZEROPOINTFIVE.ordinal()) { return getBinomialKernelSigmaZeroPointFive(); } else if (sigma.ordinal() == SIGMA.ZEROPOINTSEVENONE.ordinal()) { return getBinomialKernelSigmaZeroPointSevenOne(); } else if (sigma.ordinal() == SIGMA.ONE.ordinal()) { return getBinomialKernelSigmaOne(); } else if (sigma.ordinal() == SIGMA.ONESQRT2.ordinal()) { return getBinomialKernelSigmaOneSQRT2(); } else if (sigma.ordinal() == SIGMA.ONEPOINTFIVE.ordinal()) { return getBinomialKernelSigmaOnePointFive(); } else { return null; } }