!include once #1015415 // GrabbedImage sclass OCRRecognizeAndTeach { BufferedImage img; ImageSurface is; L rects; // use these if not null, otherwise auto-segment L texts; ReliableSingleThread rst = new(r { reRecognize() }); *(BufferedImage img) { go(img); } void go(BufferedImage img, L rects) { this.rects = rects; } void go(BufferedImage img) { this.img = img; texts = rects != null ? ocr_recognizeMultiLine_scored(img, rects) : ocr_recognizeMultiLine_scored(img); is = showImageWithRecognizedTexts(img, null, texts); showImageWithRecognizedTexts_makeTeachable2(img, is, texts, filledSimpleRecognizer_cached(), rTrigger(rst)); } void reRecognize { print("Re-recognizing..."); temp tempDisposeWindow(smallLoadingAnim()); replaceCollection(texts, ocr_recognizeMultiLine_scored(img)); is.repaint(); print("Done"); } void cleanMeUp { if (rst != null) rst.cancel(); disposeWindow(is); is = null; } }