Class UniformPaletteQuantizer
- java.lang.Object
-
- net.sourceforge.jiu.ops.Operation
-
- net.sourceforge.jiu.ops.ImageToImageOperation
-
- net.sourceforge.jiu.color.quantization.UniformPaletteQuantizer
-
- All Implemented Interfaces:
RGBQuantizer,RGBIndex
public class UniformPaletteQuantizer extends ImageToImageOperation implements RGBIndex, RGBQuantizer
A color quantizer that maps to a palette which is equidistantly distributed in the RGB color cube. Equidistantly distributed only within each channel.- Author:
- Marco Schmidt
-
-
Field Summary
Fields Modifier and Type Field Description private intBLUE_BITSprivate intBLUE_RIGHT_SHIFTprivate int[]BLUE_VALUESprivate intGREEN_BITSprivate intGREEN_LEFT_SHIFTprivate intGREEN_RIGHT_SHIFTprivate int[]GREEN_VALUESprivate int[]PALETTE_BLUEprivate int[]PALETTE_GREENprivate int[]PALETTE_REDprivate intRED_BITSprivate intRED_LEFT_SHIFTprivate intRED_RIGHT_SHIFTprivate int[]RED_VALUESprivate intTOTAL_BITS-
Fields inherited from interface net.sourceforge.jiu.data.RGBIndex
INDEX_BLUE, INDEX_GREEN, INDEX_RED
-
-
Constructor Summary
Constructors Constructor Description UniformPaletteQuantizer(int redBits, int greenBits, int blueBits)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PalettecreatePalette()Return a Palette object with the list of colors to be used in the quantization process.intmap(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.intmapToIndex(int red, int green, int blue)voidprocess()This method does the actual work of the operation.private voidprocess(RGB24Image in, Paletted8Image out)-
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
-
-
-
-
Field Detail
-
RED_BITS
private final int RED_BITS
-
RED_LEFT_SHIFT
private final int RED_LEFT_SHIFT
-
RED_RIGHT_SHIFT
private final int RED_RIGHT_SHIFT
-
RED_VALUES
private final int[] RED_VALUES
-
GREEN_BITS
private final int GREEN_BITS
-
GREEN_LEFT_SHIFT
private final int GREEN_LEFT_SHIFT
-
GREEN_RIGHT_SHIFT
private final int GREEN_RIGHT_SHIFT
-
GREEN_VALUES
private final int[] GREEN_VALUES
-
BLUE_BITS
private final int BLUE_BITS
-
BLUE_RIGHT_SHIFT
private final int BLUE_RIGHT_SHIFT
-
BLUE_VALUES
private final int[] BLUE_VALUES
-
TOTAL_BITS
private final int TOTAL_BITS
-
PALETTE_RED
private int[] PALETTE_RED
-
PALETTE_GREEN
private int[] PALETTE_GREEN
-
PALETTE_BLUE
private int[] PALETTE_BLUE
-
-
Method Detail
-
createPalette
public Palette createPalette()
Description copied from interface:RGBQuantizerReturn a Palette object with the list of colors to be used in the quantization process. That palette may be fixed or created specifically for a given input image.- Specified by:
createPalettein interfaceRGBQuantizer- Returns:
- Palette object for destination image
-
map
public int map(int[] origRgb, int[] quantizedRgb)Description copied from interface:RGBQuantizerThis method maps a triplet of intensity values to its quantized counterpart and returns the palette index of that quantized color. The index values for the two arrays are taken from RGBIndex.- Specified by:
mapin interfaceRGBQuantizer- Parameters:
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- Returns:
- int index in the palette of the match quantizedRgb
-
mapToIndex
public final int mapToIndex(int red, int green, int blue)
-
process
private void process(RGB24Image in, Paletted8Image out)
-
-