|
JIU 0.12.0 Homepage | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jiu.ops.Operation
net.sourceforge.jiu.ops.ImageToImageOperation
net.sourceforge.jiu.filters.ConvolutionKernelFilter
Applies a convolution kernel filter to an image.
GrayIntegerImage
and
RGBIntegerImage
.
ConvolutionKernelFilter filter = new ConvolutionKernelFilter(); filter.setKernel(ConvolutionKernelFilter.TYPE_SHARPEN); filter.setInputImage(image); filter.process(); PixelImage sharpenedImage = filter.getOutputImage();Use static convenience method on image
img
:
PixelImage filteredImage = ConvolutionKernelFilter.filter(img, ConvolutionKernelFilter.TYPE_BLUR);
The resulting implementation is significantly faster than the reference implementation. The contest was started by the posting [JPEC#3] Vorschläge to de.comp.lang.java by Marco Schmidt (2001-02-18) and was ended by the posting [JPEC#3] Ergebnisse (2001-03-07). A Usenet archive like Google Groups should be able to provide the postings.
Field Summary | |
static int |
TYPE_BLUR
|
static int |
TYPE_EDGE_DETECTION
|
static int |
TYPE_EMBOSS
|
static int |
TYPE_HORIZONTAL_PREWITT
|
static int |
TYPE_HORIZONTAL_SOBEL
|
static int |
TYPE_LITHOGRAPH
|
static int |
TYPE_PSYCHEDELIC_DISTILLATION
|
static int |
TYPE_SHARPEN
|
static int |
TYPE_VERTICAL_PREWITT
|
static int |
TYPE_VERTICAL_SOBEL
|
Constructor Summary | |
ConvolutionKernelFilter()
|
Method Summary | |
static PixelImage |
filter(PixelImage input,
ConvolutionKernelData data)
|
static PixelImage |
filter(PixelImage input,
int kernelType)
Filters argument image with argument kernel type and returns output image. |
void |
process()
This method does the actual work of the operation. |
void |
setKernel(ConvolutionKernelData ckd)
Sets kernel data to be used for filtering. |
void |
setKernel(int type)
Sets one of the predefined kernel types to be used for filtering. |
void |
setKernel(int[] data,
int width,
int height,
int div,
int bias)
Sets properties of the kernel to be used in this operation. |
Methods inherited from class net.sourceforge.jiu.ops.ImageToImageOperation |
canInputAndOutputBeEqual, ensureImagesHaveSameResolution, ensureInputImageIsAvailable, ensureOutputImageResolution, getInputImage, getOutputImage, setCanInputAndOutputBeEqual, setInputImage, setOutputImage |
Methods inherited from class net.sourceforge.jiu.ops.Operation |
addProgressListener, addProgressListeners, getAbort, removeProgressListener, setAbort, setProgress, setProgress |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int TYPE_BLUR
public static final int TYPE_SHARPEN
public static final int TYPE_EDGE_DETECTION
public static final int TYPE_EMBOSS
public static final int TYPE_PSYCHEDELIC_DISTILLATION
public static final int TYPE_LITHOGRAPH
public static final int TYPE_HORIZONTAL_SOBEL
public static final int TYPE_VERTICAL_SOBEL
public static final int TYPE_HORIZONTAL_PREWITT
public static final int TYPE_VERTICAL_PREWITT
Constructor Detail |
public ConvolutionKernelFilter()
Method Detail |
public static PixelImage filter(PixelImage input, int kernelType)
PixelImage blurredImage = ConvolutionKernelFilter.filter(in, ConvolutionKernelFilter.TYPE_BLUR);
public static PixelImage filter(PixelImage input, ConvolutionKernelData data)
public void process() throws MissingParameterException, WrongParameterException
Operation
process
in class Operation
MissingParameterException
- if any mandatory parameter was not given to the operation
WrongParameterException
- if at least one of the input parameters was
not initialized appropriately (values out of the valid interval, etc.)public void setKernel(int[] data, int width, int height, int div, int bias)
data
- the kernel coefficients; this one-dimensional array stores
them in order top-to-bottom, left-to-right; the length of this
array must be at least width times heightwidth
- the width of the kernel; must not be evenheight
- the height of the kernel; must not be evendiv
- the result is divided by this value after the addition of value
(so this value must not be zero)bias
- this value is added to the result before the divisionpublic void setKernel(ConvolutionKernelData ckd)
ckd
- all information necessary for filteringpublic void setKernel(int type)
type
- one of the TYPE_xyz constants of this class
IllegalArgumentException
- if the argument is not a valid TYPE_xyz constant
|
JIU 0.12.0 Homepage | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |