Uses 108K of libraries. Click here for Pure Java version (14454L/107K).
!include once #1015415 // GrabbedImage sclass OCRRecognizeAndTeach { BufferedImage img; ImageSurface is; // can pre-set this to reuse image surface L<Rect> rects; // use these if not null, otherwise auto-segment L<RecognizedText> texts; ReliableSingleThread rst = new(r { reRecognize() }); *() {} *(ImageSurface *is) { go(is.getImage()); } *(BufferedImage img) { go(img); } void go(BufferedImage img, L<Rect> rects) { this.rects = rects; go(img); } void go(BufferedImage img) { print("Recognizing"); this.img = img; texts = rec(); is = showImageWithRecognizedTexts(img, is, texts); showImageWithRecognizedTexts_makeTeachable2(img, is, texts, simpleRecognizer(), rTrigger(rst)); } L<RecognizedText> rec() { ret time("OCR", () -> rects != null ? ocr_recognizeMultiLine_scored(new BWImage(img), simpleRecognizer(), rects) : ocr_recognizeMultiLine_scored(img)); } void reRecognize { print("Re-recognizing..."); temp tempDisposeWindow(smallLoadingAnim()); replaceCollection(texts, rec()); is.repaint(); print("Done"); } void cleanMeUp { if (rst != null) rst.cancel(); disposeWindow(is); is = null; } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1015455 |
Snippet name: | OCRRecognizeAndTeach |
Eternal ID of this version: | #1015455/15 |
Text MD5: | 17937b302ea7e92c757bdd5119f831b7 |
Transpilation MD5: | 138177b1d67ecb62d03bcf19557e6557 |
Author: | stefan |
Category: | javax / ocr / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-07-12 17:01:33 |
Source code size: | 1283 bytes / 47 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 588 / 1171 |
Version history: | 14 change(s) |
Referenced in: | [show references] |