/** * Create a circular kernel where all elements within the circle * have value 1.0 while those outside have value 0.0. * Kernel width is {@code 2*radius + 1}. * The key element is at position {@code x=radius, y=radius}. * <p> * This is equivalent to: * <pre><code> * createCircle(radius, Kernel.ValueType.BINARY, 1.0f) * </code></pre> * * @param radius radius of the circle * * @return a new {@code KernelJAI} object */ public static KernelJAI createCircle(int radius) { return createConstantCircle(radius, 1.0f); }
/** * Creates a rectangular kernel where all elements have value 1.0. * The key element will be at {@code (width/2, height/2)}. * * @param width rectangle width * @param height rectangle height * * @return a new {@code KernelJAI} object * * @throws IllegalArgumentException if either {@code width} or {@code height} * are less than 1 */ public static KernelJAI createRectangle(int width, int height) { return createConstantRectangle(width, height, 1.0f); }
/** * Creates a circular kernel with width {@code 2*radius + 1}. * The key element is at position {@code x=radius, y=radius}. * * @param radius the radius of the circle expressed in pixels * @param type a {@link ValueType} constant * @param centreValue the value to assign to the kernel centre (key element) * * @return a new {@code KernelJAI} object * * @deprecated Please use {@link #createCircle(int, ValueType)} instead and * set the centre element value on the returned kernel if that is * required. */ public static KernelJAI createCircle(int radius, ValueType type, float centreValue) { KernelJAI kernel = createCircle(radius, type); return KernelUtil.setElement(kernel, radius, radius, centreValue); }
/** * Creates an annular kernel (a doughnut). * The kernel width is {@code 2*outerRadius + 1}. * The kernel's key element is at position {@code x=outerRadius, y=outerRadius}. * <p> * Calling this method with {@code innerRadius == 0} is equivalent to * calling {@link #createCircle } * * @param outerRadius the radius of the annulus * @param innerRadius the radius of the 'hole' * @param type a {@link ValueType} constant * @param centreValue the value to assign to the kernel centre (key element) * * @return a new {@code KernelJAI} object * * @throws IllegalArgumentException if {@code outerRadius <= 0} or * {@code innerRadius >= outerRadius} * * @deprecated Please use {@link #createAnnulua(int, int, ValueType)} instead and * set the centre element value on the returned kernel if that is * required. */ public static KernelJAI createAnnulus(int outerRadius, int innerRadius, ValueType type, float centreValue) { KernelJAI kernel = createAnnulus(outerRadius, innerRadius, type); return KernelUtil.setElement(kernel, outerRadius, outerRadius, centreValue); }
/** * Creates a rectangular kernel. If the element value type is one that involves * proportional distance, such as {@link ValueType#COSINE} or * {@link ValueType#EPANECHNIKOV}, this is calculated as the proportion of the * maximum distance from the key element to a kernel edge element. * * @param width rectangle width * @param height rectangle height * @param type a {@link ValueType} constant * @param keyX X ordinate of the key element * @param keyY Y ordinate of the key element (0 is top) * @param keyValue value of the key element * * @return a new {@code KernelJAI} object * * @throws IllegalArgumentException if either {@code width} or {@code height} * are less than 1; or if {@code keyX} is not in the interval {@code [0,width)}; * or if {@code keyY} is not in the interval {@code [0,height)}; * * @deprecated Please use {@link #createRectangle(int, int, ValueType, int, int)} * instead and set the centre element value on the returned kernel if that is * required. */ public static KernelJAI createRectangle( int width, int height, ValueType type, int keyX, int keyY, float keyValue) { KernelJAI kernel = createRectangle(width, height, type, keyX, keyY); return KernelUtil.setElement(kernel, keyX, keyY, keyValue); }
return createCircle(outerRadius, type);
return createCircle(outerRadius, type, centreValue);
return createCircle(outerRadius, type, centreValue);