sclass IIPureQuad extends Meta implements IIntegralImage { int imageSizeInBits; // e.g. 8 = 256*256 int[] pixelSumsByChannel; // average color of whole image stored as pixel sum IIntegralImage[] quadrants = new[4]; int imageSize() { ret 1 << imageSizeInBits; } public int getWidth() { ret imageSize(); } public int getHeight() { ret h; } int pixelCount() { ret 1 << (imageSizeInBits*2); } public double getIntegralValue(int x, int y, int channel) { ret (x+1)*(y+1)*color[channel]; } public BufferedImage getBufferedImage() { ret newBufferedImage(getWidth(), getHeight(), toColor(color)); } }