Warning: session_start(): open(/var/lib/php/sessions/sess_1pu8i576s84lhbeeo0vndgkgig, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
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]; // in scan line order
int imageSize() { ret 1 << imageSizeInBits; }
int halfSize() { ret 1 << (imageSizeInBits-1); }
public int getWidth() { ret imageSize(); }
public int getHeight() { ret imageSize(); }
int pixelCount() { ret 1 << (imageSizeInBits*2); }
public double getIntegralValue(int x, int y, int channel) {
int quadX = x >> (imageSizeInBits-1); // 0 or 1
int quadY = y >> (imageSizeInBits-1); // 0 or 1
int quadrant = quadX | (quadY << 1); // 0 to 3
int xLo = x & ~halfSize(); // clear topmost bit
int yLo = y & ~halfSize(); // clear topmost bit
// first query quadrant we landed in
int pixelSum = quadrants[quadrant].getIntegralValue(xLo, yLo, channel);
// add quadrant to the left
if (quadX != 0)
pixelSum += quadrants[quadrant-1].getIntegralValue(halfSize(), yLo, channel);
// add quadrant above
if (quadY != 0)
pixelSum += quadrants[quadrant-2].getIntegralValue(xLo, halfSize(), channel);
// add full top left quadrant
if (quadrant == 3)
pixelSum += quadrants[0].getIntegralValue(halfSize() halfSize(), channel);
ret pixelSum;
}
}