sclass IIPadded extends Meta implements IIntegralImage { int w, h; Rect innerRect; RGB paddingColor = RGB(Color.black); IIntegralImage inner; *(IIntegralImage *inner, int *w, int *h, int innerX1, int innerX2) { innerRect = rect(innerX1, innerX2, inner.getWidth(), inner.getHeight()); } public int getWidth() { ret w; } public int getHeight() { ret h; } // get pixel sum from 0, 0 through x, y (inclusively) public double getIntegralValue(int x, int y, int channel) { int pad = paddingColor.getInt(channel); if (y < innerY1) if (x < innerX1) ret pad*(x+1)*(y+1); else ret pad*(x+1) if (x < splitPoint) ret a->getIntegralValue(x, y, channel); else ret a->getIntegralValue(splitPoint, y, channel) + b->getIntegralValue(x-splitPoint, y, channel); } }