public class ColorHistogram extends Object
Constructor and Description |
---|
ColorHistogram(int[] pixelsOrig) |
ColorHistogram(int[] pixelsOrig,
boolean sortByFrequency)
Creates a color histogram instance from the supplied sequence
of color pixel values (assumed to be ARGB-encoded integers).
|
Modifier and Type | Method and Description |
---|---|
int |
getColor(int index)
Returns the unique color with the given index.
|
int |
getCount(int index)
Returns the frequency of the unique color with the given index.
|
int |
getNumberOfColors()
Returns the number of unique colors.
|
void |
listUniqueColors()
Lists the unique colors to System.out (intended for
debugging only).
|
public ColorHistogram(int[] pixelsOrig)
public ColorHistogram(int[] pixelsOrig, boolean sortByFrequency)
pixelsOrig
- Original pixel values (not modified).sortByFrequency
- Pass true to sort the final colors by descending frequency.public int getNumberOfColors()
public int getColor(int index)
index
- The color index.public int getCount(int index)
index
- The color index.public void listUniqueColors()
Copyright © 2006–2017, Wilhelm Burger, Mark J. Burge (BSD 2-Clause Simplified License)