Package com.twelvemonkeys.image
Class IndexImage.Cube
- java.lang.Object
-
- com.twelvemonkeys.image.IndexImage.Cube
-
- Enclosing class:
- IndexImage
private static class IndexImage.Cube extends java.lang.Object
Used to define a cube of the color space. The cube can be split approximately in half to generate two cubes.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static int
BLU
(package private) java.util.List<IndexImage.Counter>[]
colors
(package private) int
count
(package private) boolean
done
(package private) static int
GRN
(package private) int[]
max
(package private) int[]
min
(package private) static int
RED
-
Constructor Summary
Constructors Constructor Description Cube(java.util.List<IndexImage.Counter>[] colors, int count)
Define a new cube.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
averageColor()
Returns the average color for this cubeboolean
isDone()
If this returns true then the cube can not be subdivided any furtherIndexImage.Cube
split()
Splits the cube into two parts.IndexImage.Cube
splitChannel(int splitChannel, int c0, int c1)
Splits the image according to the parameters.
-
-
-
Field Detail
-
min
int[] min
-
max
int[] max
-
done
boolean done
-
colors
java.util.List<IndexImage.Counter>[] colors
-
count
int count
-
RED
static final int RED
- See Also:
- Constant Field Values
-
GRN
static final int GRN
- See Also:
- Constant Field Values
-
BLU
static final int BLU
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Cube
public Cube(java.util.List<IndexImage.Counter>[] colors, int count)
Define a new cube.- Parameters:
colors
- contains the 3D color histogram to be subdividedcount
- the total number of pixels in the 3D histogram.
-
-
Method Detail
-
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
public IndexImage.Cube 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
public IndexImage.Cube splitChannel(int splitChannel, int c0, int c1)
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
-
-