Package com.twelvemonkeys.image
Class IndexImage.Cube
java.lang.Object
com.twelvemonkeys.image.IndexImage.Cube
- Enclosing class:
IndexImage
Used to define a cube of the color space. The cube can be split
approximately in half to generate two cubes.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int
(package private) List<IndexImage.Counter>[]
(package private) int
(package private) boolean
(package private) static final int
(package private) int[]
(package private) int[]
(package private) static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the average color for this cubeboolean
isDone()
If this returns true then the cube can not be subdivided any furthersplit()
Splits the cube into two parts.splitChannel
(int splitChannel, int c0, int c1) Splits the image according to the parameters.
-
Field Details
-
min
int[] min -
max
int[] max -
done
boolean done -
colors
List<IndexImage.Counter>[] colors -
count
int count -
RED
static final int RED- See Also:
-
GRN
static final int GRN- See Also:
-
BLU
static final int BLU- See Also:
-
-
Constructor Details
-
Cube
Define a new cube.- Parameters:
colors
- contains the 3D color histogram to be subdividedcount
- the total number of pixels in the 3D histogram.
-
-
Method Details
-
isDone
public boolean isDone()If this returns true then the cube can not be subdivided any further- Returns:
- true if cube can not be subdivided any further
-
split
Splits the cube into two parts. This cube is changed to be one half and the returned cube is the other half. This tries to pick the right channel to split on.- Returns:
- the
Cube
containing the other half
-
splitChannel
Splits the image according to the parameters. It tries to find a location where half the pixels are on one side and half the pixels are on the other.- Parameters:
splitChannel
- split channelc0
- channel 0c1
- channel 1- Returns:
- the
Cube
containing the other half
-
averageColor
public int averageColor()Returns the average color for this cube- Returns:
- the average
-