private RGBColorList createColorList(RGB24Image image) throws OperationFailedException
{
Histogram3DCreator hc = new Histogram3DCreator();
hc.setImage(image, RGBIndex.INDEX_RED, RGBIndex.INDEX_GREEN, RGBIndex.INDEX_BLUE);
hc.process();
Histogram3D hist = hc.getHistogram();
if (hist == null)
{
throw new OperationFailedException("Could not create histogram from input image.");
}
int numUniqueColors = hist.getNumUsedEntries();
if (numUniqueColors <= paletteSize)
{
throw new WrongParameterException("Input image has only " + numUniqueColors +
" unique color(s), so it cannot be reduced to " + paletteSize +
" color(s).");