!7 cm LetterboxOnScreen2 > DynPrintLogAndEnabled { switchable double frequency = 5.0; // 5 fps transient S shootingTime, conversionTime, recognitionTime; transient Map alwaysOnTopWindows = syncMap(); void cleanMeUp_windows { disposeWindows(getValuesAndClear(alwaysOnTopWindows)); } JComponent wrapControlArea() { ret northAndCenterWithMargin( hgridWithSpacing( dm_fieldLabelWithLabel shootingTime(), dm_fieldLabelWithLabel conversionTime(), dm_fieldLabelWithLabel recognitionTime()), super.wrapControlArea()); } start { dm_reloadOnFieldChange interval(); dm_doEvery(doubleRatio(1, frequency), r doIt); } void doIt { if (!enabled) ret with cleanMeUp_windows(); var rect = screenBounds(1); if (rect == null) ret; new TimeTaker tt; tt.start(); var img = shootScreen2(rect); setField(shootingTime := tt.renderMicroseconds()); tt.start(); var ii = IntegralImage(img); setField(conversionTime := tt.renderMicroseconds()); tt.start(); new Var theBox; hijackPrint(r { stepAllWithStats(new ULetterbox1().run(ii, setVarWithConversion toRect(theBox))); }); setField(recognitionTime := tt.renderMicroseconds()); print(imageBounds(img) + " - " + theBox!); //showImageWithSelection(img, theBox!); var box1 = rect(rect.x, rect.y, rect.w, theBox->y); var box2 = rectFromPoints(rect.x, rect.y+theBox->y2(), rect.x2(), rect.y2()); printVars(+box1, +box2); positionMarkerWindow(0, box1, withAlpha(.2, Color.green)); positionMarkerWindow(1, box2, withAlpha(.2, Color.green)); } JWindow getOrCreateMarkerWindow(O key) { ret swing(() -> syncMapGetOrCreate(alwaysOnTopWindows, key, () -> makeAlwaysOnTopTranslucentWindow())); } void positionMarkerWindow(int iWindow, Rect box, Color color) { awt { JWindow w = getOrCreateMarkerWindow(iWindow); setBounds(w, box); w.setBackground(color); w.setVisible(true); } } }