private static class IndexImage.Cube
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) static int |
BLU |
(package private) IndexImage.Counter[][] |
colors
the colors-array is not modified - in fact, all cubes use
the same colors-array.
|
(package private) int |
count
the number of color-points in this cube.
|
(package private) boolean |
done |
(package private) static int |
GRN |
(package private) int[] |
max |
(package private) int[] |
min |
(package private) static int |
RED |
(package private) static byte[] |
RGB_BLACK |
Constructor and Description |
---|
Cube(IndexImage.Counter[][] colors,
int count)
Define a new cube.
|
Modifier and Type | Method and Description |
---|---|
int |
averageColor()
Returns the average color for this cube (no alpha).
|
byte[] |
averageColorRGB(byte[] rgb)
Returns the average color for this cube
|
private int[] |
computeCounts(int splitChannel,
int c0,
int c1)
create an array, which contains the number of pixels for
each point along the splitChannel (between min and max of
this cube).
|
private boolean |
contains(int[] val)
check, if the color defined by val[] is inside this cube.
|
boolean |
isDone()
If this returns true then the cube can not be subdivided any
further
|
private void |
normalize(int splitChannel,
int[] counts)
Adjust (normalize) min/max of this cube so that they span
the actual content.
|
(package private) IndexImage.Cube |
split()
Splits the cube into two parts.
|
(package private) IndexImage.Cube |
splitChannel(int splitChannel,
int c0,
int c1)
Splits the image according to the parameters.
|
java.lang.String |
toString()
convert the cube-content to String-representation for logging.
|
static final byte[] RGB_BLACK
int[] min
int[] max
boolean done
final IndexImage.Counter[][] colors
int count
static final int RED
static final int GRN
static final int BLU
Cube(IndexImage.Counter[][] colors, int count)
colors
- contains the 3D color histogram to be subdividedcount
- the total number of pixels in the 3D histogram.public boolean isDone()
private boolean contains(int[] val)
val
- int[ 3 ] containing r,g,b-valuesIndexImage.Cube split()
private void normalize(int splitChannel, int[] counts)
computeCounts(int, int, int)
really computes
all counts-values (and does not stop after the
necessary number of points for a split is found, as it was
done in the previous version of this class).splitChannel
- the color used for the last splitcounts
- contains the number of points along the splitChannel
- only counts[ min .. max ] is valid.IndexImage.Cube splitChannel(int splitChannel, int c0, int c1)
private int[] computeCounts(int splitChannel, int c0, int c1)
splitChannel
- one of RED | GRN | BLUc0
- one of the other channelsc1
- the third channelpublic java.lang.String toString()
toString
in class java.lang.Object
public int averageColor()
public byte[] averageColorRGB(byte[] rgb)