Warning: session_start(): open(/var/lib/php/sessions/sess_etauoifu3aj88pkvtam8he1fl6, 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 URecognizer {
IIntegralImage image;
*() {}
*(IIntegralImage *image) {}
*(BufferedImage image) {
this.image = IntegralImage(image);
}
// returns 0, 1 or 2
int posterizeToInt(double x) {
ret ifloor(clampZeroToOne(x)*3);
}
// returns 0, .5 or 1
double posterizeInPlace(double x) {
ret posterizeToInt(x)*.5;
}
class Cell {
// Which part of the image we are looking at (x/y)
// dimension 0 = x, dimension 1 = y
DoubleRange[] clip = new[2];
// color transformations in place
DoubleRange[] colorClips = new[3];
Cell copy() {
new Cell c;
arrayCopy(clip, c.clip);
arrayCopy(colorClips, c.colorClips);
ret c;
}
Rect rectInImage() {
ret toRect_floor(doubleRectFromRanges(clip[0], clip[1]));
}
// get color of cell
double color(int channel) {
double color = ii_averageBrightnessOfArea(image, rectInImage(), channel);
ret transformBetweenDoubleRanges(color, colorClips[channel], zeroToOne());
}
// unposterized color of all 3 channels
double[] color() {
double[] c = new[3];
for i to 3:
c[i] = color(i);
ret c;
}
toString {
ret "Color: " + asList(color());
}
int posterizedIntColor(int channel) {
ret posterizeToInt(color(channel));
}
// get sub-cells
Cell[] split(int dimension) {
Cell[] cells = new[3];
for i to 3: cells[i] = slice(dimension, i/3.0, (i+1)/3.0);
ret cells;
}
Cell slice(int dimension, double a, double b) {
Cell c = copy();
c.clip[dimension] = transformBetweenDoubleRanges(DoubleRange(a, b), zeroToOne(), clip[dimension]);
ret c;
}
}
// make the root cell
Cell rootCell() {
new Cell c;
c.clip[0] = doubleRange(0, image.getWidth());
c.clip[1] = doubleRange(0, image.getHeight());
for i to 3: c.colorClips[i] = doubleRange(0, 255);
ret c;
}
}