Uses 108K of libraries. Click here for Pure Java version (11204L/81K).
!include once #1015415 // GrabbedImage svoid ocr_teachPhraseForm(final GrabbedImage gi, final SimpleRecognizer sr, final VF1<S> onTaught) { analyzeGrabbedImage(gi, sr); // make form final JTextField tf = jTypeWriterTextField(ocr_joinAsGrouped(gi.groupedRecognition)); final JCheckBox grouped = jCheckBox("grouped (" + ocrCharGroupingHelpText() + ")", true); final JButton btnSubmit = jbutton("Submit", r { S s = trim(tf.getText()); bool group = isChecked(grouped); L<Rect> rects = gi.rects; if (group) { rects = ocr_groupRects(rects, s); s = ocr_unmerge(s); } saveScreenClip(gi.image); L<S> characterMD5s = md5OfBWImageParts(gi.image, rects); if (sr.fullSearchMap != null) for i over rects: sr.fullSearchMap.put(gi.image.clip(rects.get(i)), characterMD5s.get(i)); S line = "The images " + quote(join(" ", characterMD5s)) + " are the " + (group ? "grouped " : "") + "characters " + quote(s) + "."; print(">> " + line); S imageMD5 = ocrMD5OfBWImage(gi.image); logQuoted(glyphTeachLog(), "[" + localDateWithSeconds() + "] Image " + imageMD5 + ": " + line); saveTextFile(newFile(screenClipsDir(), imageMD5 + ".line"), line); sr.load(line); disposePossiblyInternalFrame(tf); pcallF(onTaught, s); }); onUpdateAndNow(ll(tf, grouped), r { S s = trim(tf.getText()); btnSubmit.setEnabled((isChecked(grouped) ? ocr_glyphCount(s) : l(dropSpaces(s))) == l(gi.characters)); }); // show form growFrameSouth(50, showFormTitled("Teach", "Image:" , jscroll_minHeight(75, zoomedImageSurface(2, gi.image.getBufferedImage())), "Split:" , jscroll_minHeight(75, zoomedImageSurface(2, gi.visualizedSplit.getBufferedImage())), "Meaning:", tf, "", grouped, "", btnSubmit)); selectAllLater(tf, 100); }
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1015395 |
Snippet name: | ocr_teachPhraseForm |
Eternal ID of this version: | #1015395/11 |
Text MD5: | 8de91f3b7a049e4354cbd4287c5b4567 |
Transpilation MD5: | 1e18005ffc26fb50a46bc0dc83d66ad8 |
Author: | stefan |
Category: | javax / imaging / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-07-12 17:05:59 |
Source code size: | 1865 bytes / 45 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 342 / 447 |
Version history: | 10 change(s) |
Referenced in: | [show references] |