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); }
/** * Creates a rectangular kernel where all elements have the same value. * The key element will be at {@code (width/2, height/2)}. * * @param width rectangle width * @param height rectangle height * @param value element value * * @return a new {@code KernelJAI} object * * @throws IllegalArgumentException if either {@code width} or {@code height} * are less than 1 */ public static KernelJAI createConstantRectangle(int width, int height, float value) { if (width < 1 || height < 1) { throw new IllegalArgumentException("width and height must both be >= 1"); } float [] weights = (new KernelFactoryHelper()).makeRect(width, height, value); return new KernelJAI(width, height, weights); }
/** * Creates a rectangular kernel where all elements have the same value. * * @param width rectangle width * @param height rectangle height * @param value element value * @param keyX key element X ordinate * @param keyY key element Y ordinate * * @return a new {@code KernelJAI} object * * @throws IllegalArgumentException if either {@code width} or {@code height} * are less than 1 or if the key element location is outside the * rectangle */ public static KernelJAI createConstantRectangle(int width, int height, int keyX, int keyY, float value) { if (width < 1 || height < 1) { throw new IllegalArgumentException("width and height must both be >= 1"); } if (keyX < 0 || keyX >= width || keyY < 0 || keyY >= height) { throw new IllegalArgumentException("key element must be within the rectangle"); } float [] weights = (new KernelFactoryHelper()).makeRect(width, height, value); return new KernelJAI(width, height, keyX, keyY, weights); }
/** * Creates a new KernelJAI object with a rectangular configuraton. * An IllegalArgumentException will be thrown if width or height are less than 1. * <p> * This is equivalent to calling... * <p> * {@code createRectangle(width, height, Kernel.ValueType.BINARY, width/2, height/2, 1.0f) } * * @param width rectangle width * @param height rectangle height * * @return a new instance of KernelJAI */ public static KernelJAI createRectangle(int width, int height) { float [] weights = (new KernelFactoryHelper()).makeRect(width, height); return new KernelJAI(width, height, weights); }
/** * Creates a new KernelJAI object with a rectangular configuraton. * An IllegalArgumentException will be thrown if width or height are less than 1. * <p> * This is equivalent to calling... * <p> * {@code createRectangle(width, height, Kernel.ValueType.BINARY, width/2, height/2, 1.0f) } * * @param width rectangle width * @param height rectangle height * * @return a new instance of KernelJAI */ public static KernelJAI createRectangle(int width, int height) { float [] weights = (new KernelFactoryHelper()).makeRect(width, height); return new KernelJAI(width, height, weights); }
KernelFactoryHelper kh = new KernelFactoryHelper();
KernelFactoryHelper kh = new KernelFactoryHelper();
KernelFactoryHelper kh = new KernelFactoryHelper();
/** * 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); }
KernelFactoryHelper kh = new KernelFactoryHelper(); float weights[];
KernelFactoryHelper kh = new KernelFactoryHelper();
KernelFactoryHelper kh = new KernelFactoryHelper();
KernelFactoryHelper kh = new KernelFactoryHelper(); float weights[];
KernelFactoryHelper kh = new KernelFactoryHelper(); float weights[];