public class ReduceShadesOfGray extends ImageToImageOperation
setBits(int)), the others are dropped
and the result is scaled back to either 8 or 16 bits to fit
into the two grayscale image types.
Gray8Image
and Gray16Image.
ReduceShadesOfGray reduce = new ReduceShadesOfGray(); reduce.setBits(3); reduce.setInputImage(image); // some Gray8Image or Gray16Image reduce.process(); PixelImage reducedImage = reduce.getOutputImage();
| Modifier and Type | Field | Description |
|---|---|---|
private Integer |
destBits |
Number of significant bits in the destination grayscale image.
|
private int[] |
lut |
Lookup table, for each possible input sample stores the
corresponding output sample.
|
| Constructor | Description |
|---|---|
ReduceShadesOfGray() |
| Modifier and Type | Method | Description |
|---|---|---|
private void |
createLut(int inDepth) |
|
void |
process() |
This method does the actual work of the operation.
|
private void |
process(GrayIntegerImage in,
int MASK,
BilevelImage out) |
|
private void |
process(GrayIntegerImage in,
GrayIntegerImage out) |
|
void |
setBits(int bits) |
Specifies the number of bits the output image is supposed to have.
|
canInputAndOutputBeEqual, ensureImagesHaveSameResolution, ensureInputImageIsAvailable, ensureOutputImageResolution, getInputImage, getOutputImage, setCanInputAndOutputBeEqual, setInputImage, setOutputImageclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddProgressListener, addProgressListeners, getAbort, removeProgressListener, setAbort, setProgress, setProgressprivate Integer destBits
private int[] lut
private void createLut(int inDepth)
private void process(GrayIntegerImage in, int MASK, BilevelImage out)
private void process(GrayIntegerImage in, GrayIntegerImage out)
public void process()
throws MissingParameterException,
WrongParameterException
Operationprocess in class OperationMissingParameterException - 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.)public void setBits(int bits)
bits - number of bits in output image, from 1 to 15IllegalArgumentException - if bits is smaller than 1 or larger than 15