Download Jar. Uses 3874K of libraries. Click here for Pure Java version (12388L/89K).
1 | !7 |
2 | |
3 | // approximate size: 10,17 |
4 | // approximate y distance: 615-593 |
5 | |
6 | static RGB destColor = rgb("#5650C3"); |
7 | static float contrast = 5f; |
8 | static float gamma = 0.5f; |
9 | |
10 | static int g = 2; |
11 | |
12 | p-experiment { |
13 | //RGBImage img = shootScreen(); |
14 | RGBImage img = loadRGBImage(/*#1101257*/#1101258); |
15 | int w = img.getWidth(), h = img.getHeight(); |
16 | BWImage bw = new BWImage(w, h); |
17 | int destColorInt = destColor.getInt(); |
18 | for y to h: for x to w: { |
19 | float diff = rgbDiff(img.getInt(x, y), destColorInt); |
20 | //diff = pow(diff, gamma); |
21 | //diff *= contrast; |
22 | diff = (diff-0.2f)*20f; |
23 | bw.setPixel(x, y, diff); |
24 | } |
25 | //showBWImage(bw); |
26 | //showAutoSegmentedImage(bw); |
27 | final L<Rect> rects = sortRectsByMiddleY(autoSegment(bw, g)); |
28 | pnl(rects); |
29 | final ImageSurface is1 = showImageWithSelections(bw, rects); |
30 | onClick(is1, voidfunc(MouseEvent e) { |
31 | Pt p = is1.pointFromEvent(e); |
32 | pnl(rectsContaining(p, rects)); |
33 | }); |
34 | |
35 | L<Rect> l2 = rectsWithSize(rects, 10, 17); |
36 | for (Rect r : l2) |
37 | print(simpleRecognizer().recognizeGlyph(bw.clip(r))); |
38 | |
39 | BufferedImage bi = bw.getBufferedImage(); |
40 | L<RecognizedText> texts = ocr_recognizeMultiLine_scored(bw, simpleRecognizer(), l2); |
41 | ImageSurface is = showImageWithRecognizedTexts(bi, null, texts); |
42 | showImageWithRecognizedTexts_makeTeachable2(bi, is, texts, filledSimpleRecognizer_cached(), null); |
43 | } |
Began life as a copy of #1015464
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1015466 |
Snippet name: | Find blue terminal $ on screen using grid [dev. 2] |
Eternal ID of this version: | #1015466/29 |
Text MD5: | 1d5b9308460351508cd10ac7013cd21c |
Transpilation MD5: | 015ef35b2ca853580a803460c07729ad |
Author: | stefan |
Category: | javax / ocr |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-15 01:17:22 |
Source code size: | 1390 bytes / 43 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 430 / 1152 |
Version history: | 28 change(s) |
Referenced in: | [show references] |