public static KernelJAI createConstantCircle(int radius, float value) { if (radius <= 0) { throw new IllegalArgumentException( "Invalid radius (" + radius + "); must be > 0"); } KernelFactoryHelper helper = new KernelFactoryHelper(); float[] weights = helper.makeCircle(radius); int w = 2*radius + 1; helper.rowFill(weights, w, w, value); return new KernelJAI(w, w, weights); }
/** * Create a new KernelJAI object with a circular configuration. * Kernel elements within the circle will have value 1.0f; those * outside will have value 0.0f. * <p> * This is equivalent to, but faster than, calling... * <p> * {@code createCircle(radius, Kernel.ValueType.BINARY, 1.0f) } * * @param radius radius of the circle * @return a new instance of KernelJAI */ public static KernelJAI createCircle(int radius) { if (radius <= 0) { throw new IllegalArgumentException( "Invalid radius (" + radius + "); must be > 0"); } KernelFactoryHelper kh = new KernelFactoryHelper(); float[] weights = kh.makeCircle(radius); int w = 2*radius + 1; kh.rowFill(weights, w, w); return new KernelJAI(w, w, weights); }
/** * Create a new KernelJAI object with a circular configuration. * Kernel elements within the circle will have value 1.0f; those * outside will have value 0.0f. * <p> * This is equivalent to, but faster than, calling... * <p> * {@code createCircle(radius, Kernel.ValueType.BINARY, 1.0f) } * * @param radius radius of the circle * @return a new instance of KernelJAI */ public static KernelJAI createCircle(int radius) { if (radius <= 0) { throw new IllegalArgumentException( "Invalid radius (" + radius + "); must be > 0"); } KernelFactoryHelper kh = new KernelFactoryHelper(); float[] weights = kh.makeCircle(radius); int w = 2*radius + 1; kh.rowFill(weights, w, w); return new KernelJAI(w, w, weights); }