!7 replace Submission with BackgroundPlus. cmodule2 BoxFinder > DynImageSurfaceAndEnabled { switchable int imageSize = 1000; ExpectedAndActual> lastError; transient Pair actual, recognized; transient BWIntegralImage ii; transient ImageSurface isReconstructed; transient S status; transient new Scorer scorer; visual northAndCenterWithMargin( 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 { 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 { recognized = sortedPair(bwii_detectSingleLine(ii)); } void score { bool ok = eq(actual, recognized); scorer.add(ok); if (!ok) setField(lastError := actual); } 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 := str(scorer) + (lastError == null ? "" : ", l ast error: " + lastError)); } }