Class IndexImage.Cube

java.lang.Object
com.twelvemonkeys.image.IndexImage.Cube
Enclosing class:
IndexImage

private static class IndexImage.Cube extends Object
Used to define a cube of the color space. The cube can be split approximately in half to generate two cubes.
  • Field Details

  • Constructor Details

    • Cube

      public Cube(List<IndexImage.Counter>[] colors, int count)
      Define a new cube.
      Parameters:
      colors - contains the 3D color histogram to be subdivided
      count - 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

      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 channel
      c0 - channel 0
      c1 - channel 1
      Returns:
      the Cube containing the other half
    • averageColor

      public int averageColor()
      Returns the average color for this cube
      Returns:
      the average