Package com.jhlabs.image
Class ConvolveFilter
java.lang.Object
com.jhlabs.image.AbstractBufferedImageOp
com.jhlabs.image.ConvolveFilter
- All Implemented Interfaces:
BufferedImageOp
,Cloneable
- Direct Known Subclasses:
AverageFilter
,BlurFilter
,BumpFilter
,GaussianFilter
,SharpenFilter
A filter which applies a convolution kernel to an image.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
static int
protected Kernel
static int
static int
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a filter with a null kernel.ConvolveFilter
(float[] matrix) Construct a filter with the given 3x3 kernel.ConvolveFilter
(int rows, int cols, float[] matrix) Construct a filter with the given kernel.ConvolveFilter
(Kernel kernel) Construct a filter with the given 3x3 kernel. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
convolve
(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) static void
static void
convolveH
(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) Convolve with a kernel consisting of one rowstatic void
convolveHV
(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) Convolve with a 2D kernelstatic void
convolveV
(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) Convolve with a kernel consisting of one columncreateCompatibleDestImage
(BufferedImage src, ColorModel dstCM) filter
(BufferedImage src, BufferedImage dst) getBounds2D
(BufferedImage src) int
getPoint2D
(Point2D srcPt, Point2D dstPt) boolean
void
setEdgeAction
(int edgeAction) void
void
setUseAlpha
(boolean useAlpha) toString()
Methods inherited from class com.jhlabs.image.AbstractBufferedImageOp
clone, getRGB, setRGB
-
Field Details
-
ZERO_EDGES
public static int ZERO_EDGES -
CLAMP_EDGES
public static int CLAMP_EDGES -
WRAP_EDGES
public static int WRAP_EDGES -
kernel
-
alpha
protected boolean alpha
-
-
Constructor Details
-
ConvolveFilter
public ConvolveFilter()Construct a filter with a null kernel. This is only useful if you're going to change the kernel later on. -
ConvolveFilter
public ConvolveFilter(float[] matrix) Construct a filter with the given 3x3 kernel.- Parameters:
matrix
- an array of 9 floats containing the kernel
-
ConvolveFilter
public ConvolveFilter(int rows, int cols, float[] matrix) Construct a filter with the given kernel.- Parameters:
rows
- the number of rows in the kernelcols
- the number of columns in the kernelmatrix
- an array of rows*cols floats containing the kernel
-
ConvolveFilter
Construct a filter with the given 3x3 kernel.- Parameters:
matrix
- an array of 9 floats containing the kernel
-
-
Method Details
-
setKernel
-
getKernel
-
setEdgeAction
public void setEdgeAction(int edgeAction) -
getEdgeAction
public int getEdgeAction() -
setUseAlpha
public void setUseAlpha(boolean useAlpha) -
getUseAlpha
public boolean getUseAlpha() -
filter
-
createCompatibleDestImage
- Specified by:
createCompatibleDestImage
in interfaceBufferedImageOp
- Overrides:
createCompatibleDestImage
in classAbstractBufferedImageOp
-
getBounds2D
- Specified by:
getBounds2D
in interfaceBufferedImageOp
- Overrides:
getBounds2D
in classAbstractBufferedImageOp
-
getPoint2D
- Specified by:
getPoint2D
in interfaceBufferedImageOp
- Overrides:
getPoint2D
in classAbstractBufferedImageOp
-
getRenderingHints
- Specified by:
getRenderingHints
in interfaceBufferedImageOp
- Overrides:
getRenderingHints
in classAbstractBufferedImageOp
-
convolve
public static void convolve(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, int edgeAction) -
convolve
public static void convolve(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) -
convolveHV
public static void convolveHV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) Convolve with a 2D kernel -
convolveH
public static void convolveH(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) Convolve with a kernel consisting of one row -
convolveV
public static void convolveV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) Convolve with a kernel consisting of one column -
toString
-