Libraryless. Click here for Pure Java version (8375L/59K/227K).
!7 !include #1005875 // Distinguisher please include function img_upperWidthToLowerWidth. please include function img_averageWidthDividedByHeight. please include function img_centralPixelSet. please include function img_leftishness. sS font = "#1004569"; static float size = 10f; static BWImage render(S text) { ret autoCroppedBWImage(renderText(font, size, text)); } p-type { showBWImage(render("01")); new Distinguisher d; for (final S f : splitAtSpace("upperWidthToLowerWidth averageWidthDividedByHeight centralPixelSet leftishness")) d.addFunction(f, func(BWImage img) { call(mc(), "img_" + f, img) }); print("Got " + l(d.functions) + " functions."); int lastQuality = -1, sizes = 0; for (size = 60f; size >= 10f; size--) { ++sizes; print("Rendering size " + (int) size); d.analyze(ll(render("0"), render("1"))); int quality = d.quality(); if (quality != lastQuality) { print("Distinguisher quality now: " + quality); if (quality == 0) break; lastQuality = quality; } } print(); d.printStuff(); printAsciiHeading("Summary"); print("Analyzed '0' and '1' in font " + font + " in " + sizes + " sizes."); print("=> " + (d.good() ? "Discriminator good (quality=" + d.quality() + ")" : "Discriminator failed"; }
Began life as a copy of #1005852
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wtqryiryparv
No comments. add comment
Snippet ID: | #1005878 |
Snippet name: | Learn to read v2 (using Distinguisher) |
Eternal ID of this version: | #1005878/2 |
Text MD5: | b3f26edb476a5628322d9f1a69bbfa81 |
Transpilation MD5: | baa81dbafd23e3586aa18ebd7e5cc347 |
Author: | stefan |
Category: | javax / ocr |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-09-11 22:14:16 |
Source code size: | 1352 bytes / 46 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 585 / 662 |
Version history: | 1 change(s) |
Referenced in: | [show references] |