Warning: session_start(): open(/var/lib/php/sessions/sess_0qjsdaioorj3c4e397j0im1uub, 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
!7
replace Submission with BackgroundPlus.
cmodule2 BoxFinder > DynImageSurfaceAndEnabled {
switchable int imageSize = 1000;
switchable int warmups = 10; // per round
switchable int initialWarmups = 100000;
ExpectedAndActual> lastError;
transient Pair actual, recognized;
transient BWIntegralImage ii;
transient ImageSurface isReconstructed;
transient S status;
transient new Scorer scorer;
transient new Average recTime;
transient NotTooOften clearRecTime = nto_everyTenSeconds();
transient long rounds;
visual
centerAndSouthWithMargin(
jhgrid(super,
jscroll_centered(isReconstructed = imageSurface())),
dm_label status());
start {
thread "Calc" enter {
while (true) {
if (deleted()) ret;
if (!enabled) continue with sleepSeconds(1);
pcall {
if (clearRecTime!) recTime.clear();
makeImage();
recognize();
score();
reconstruct();
status();
}
}
}
}
void makeImage {
Pt a = randomPt(imageSize), b = randomPt(imageSize);
LineWithColor line = new(a, b, Color.black, 1);
BufferedImage img = renderBackgroundPlusLines(imageSize, imageSize, new BackgroundPlus(Color.white, line));
setImage(img);
ii = new BWIntegralImage(img);
actual = sortedPair(a, b);
}
void recognize {
int w = rounds == 0 ? initialWarmups : warmups;
++rounds;
repeat w { bwii_detectSingleLine(ii); }
long time = nanoTime();
Pair output = bwii_detectSingleLine(ii);
recTime.add(nanoTime()-time);
recognized = sortedPair(output);
}
void score {
bool ok = eq(actual, recognized);
scorer.add(ok);
if (!ok) setField(lastError := ExpectedAndActual(actual, recognized));
}
void reconstruct {
BufferedImage img = renderBackgroundPlusLines(imageSize, imageSize, new BackgroundPlus(Color.white, LineWithColor(actual.a, actual.b, Color.black, 1)));
isReconstructed.setImage(img);
}
void status {
setField(status := joinNemptiesWithComma(
str(scorer),
"recognition time: " + iround(recTime!) + " ns",
lastError == null ?: "last error: " + lastError));
}
}