public class OilFilter extends AreaFilterOperation
GrayIntegerImage
and
RGBIntegerImage
.
Note that this operation becomes very slow with 16 bits per sample
because a lot of runs over a 65536 element array are necessary.
PixelImage image = ...; // some GrayIntegerImage or RGBIntegerImage OilFilter filter = new OilFilter(); filter.setArea(5, 5); filter.setInputImage(image); filter.process(); PixelImage filteredImage = filter.getOutputImage();
Modifier and Type | Field and Description |
---|---|
private int[] |
hist |
private int[] |
zeroes |
Constructor and Description |
---|
OilFilter() |
Modifier and Type | Method and Description |
---|---|
int |
computeSample(int[] samples,
int numSamples)
Determine the resulting sample for an array with the source sample
and zero or more of its neighbors.
|
void |
process()
This method does the actual work of the operation.
|
checkAreaHeight, checkAreaWidth, getAreaHeight, getAreaWidth, setArea, setAreaHeight, setAreaWidth
canInputAndOutputBeEqual, ensureImagesHaveSameResolution, ensureInputImageIsAvailable, ensureOutputImageResolution, getInputImage, getOutputImage, setCanInputAndOutputBeEqual, setInputImage, setOutputImage
addProgressListener, addProgressListeners, getAbort, removeProgressListener, setAbort, setProgress, setProgress
public final int computeSample(int[] samples, int numSamples)
AreaFilterOperation
numSamples
samples, which will be stored
starting at offset 0
.
Normally, numSamples
is equal to AreaFilterOperation.getAreaWidth()
times AreaFilterOperation.getAreaHeight()
.
Near the border of the image you may get less samples.
Example: the top left sample of an image has only three neighbors (east, south-east and south),
so you will only get four samples (three neighbors and the sample itself).
computeSample
in class AreaFilterOperation
samples
- the array holding the sample(s)numSamples
- number of samples in the arraypublic void process() throws MissingParameterException, WrongParameterException
Operation
process
in class AreaFilterOperation
MissingParameterException
- if any mandatory parameter was not given to the operationWrongParameterException
- if at least one of the input parameters was
not initialized appropriately (values out of the valid interval, etc.)