|
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.color.quantization.PopularityQuantizer
Performs the popularity color quantization algorithm that maps an image to
the colors occurring most frequently in the input image.
The number of colors in the palette can be defined by the user of this
operation with setPaletteSize(int)
.
RGB24Image
,
the output image must be of type Paletted8Image
.
PopularityQuantizer quantizer = new PopularityQuantizer(); quantizer.setInputImage(image); quantizer.setPaletteSize(256); quantizer.process(); PixelImage quantizedImage = quantizer.getOutputImage();
ArbitraryPaletteQuantizer
Field Summary |
Fields inherited from interface net.sourceforge.jiu.data.RGBIndex |
INDEX_BLUE, INDEX_GREEN, INDEX_RED |
Constructor Summary | |
PopularityQuantizer()
|
Method Summary | |
Palette |
createPalette()
Return a Palette object with the list of colors to be used in the quantization process. |
int |
getPaletteSize()
Returns the number of colors in the destination image. |
int |
map(int[] origRgb,
int[] quantizedRgb)
This method maps a triplet of intensity values to its quantized counterpart and returns the palette index of that quantized color. |
void |
process()
This method does the actual work of the operation. |
void |
setMapping(boolean newValue)
Specifies whether this operation will map the image to the new palette (true) or not (false). |
void |
setPaletteSize(int newPaletteSize)
Sets the number of colors that this operations is supposed to reduce the original image to. |
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 |
Constructor Detail |
public PopularityQuantizer()
Method Detail |
public Palette createPalette()
RGBQuantizer
createPalette
in interface RGBQuantizer
public int getPaletteSize()
setPaletteSize(int)
public int map(int[] origRgb, int[] quantizedRgb)
RGBQuantizer
map
in interface RGBQuantizer
origRgb
- the three samples red, green and blue for which a good match is searched in the palettequantizedRgb
- will hold the three samples found to be closest to origRgb after the call to this method
public void process() throws MissingParameterException, OperationFailedException, 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.)
OperationFailedException
public void setMapping(boolean newValue)
newValue
- map to new image (true) or just search palette (false)public void setPaletteSize(int newPaletteSize)
newPaletteSize
- the number of colors
IllegalArgumentException
- if the argument is smaller than 1 or larger than 256getPaletteSize()
|
JIU 0.12.0 Homepage | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |