Class 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 cube
      boolean isDone()
      If this returns true then the cube can not be subdivided any further
      IndexImage.Cube split()
      Splits the cube into two parts.
      IndexImage.Cube splitChannel​(int splitChannel, int c0, int c1)
      Splits the image according to the parameters.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 subdivided
        count - 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 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