1 | static RGB unixTerminalDollarFinder_destColor = rgb("#5650C3"); |
2 | |
3 | static L<Rect> unixTerminalDollarFinder(BufferedImage screenshot) { |
4 | int w = screenshot.getWidth(), h = screenshot.getHeight(); |
5 | BWImage bw = new BWImage(w, h); |
6 | int destColorInt = unixTerminalDollarFinder_destColor.getInt(); |
7 | for y to h: for x to w: { |
8 | float diff = rgbDiff(screenshot.getRGB(x, y), destColorInt); |
9 | diff = (diff-0.2f)*10f; |
10 | bw.setPixel(x, y, diff); |
11 | } |
12 | final L<Rect> rects = sortRectsByMiddleY(autoSegment(bw, 2)); |
13 | |
14 | L<Rect> l2 = rectsWithSize(rects, 10, 17); |
15 | new L<Rect> found; |
16 | for (Rect r : l2) { |
17 | Scored<SimpleRecognizer.GlyphInfo> gi = simpleRecognizer().recognizeGlyph(bw.clip(r)); |
18 | if (gi.has() && eq(gi->meaning, "$")) |
19 | found.add(r); |
20 | } |
21 | ret found; |
22 | } |
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: | #1015477 |
Snippet name: | unixTerminalDollarFinder |
Eternal ID of this version: | #1015477/7 |
Text MD5: | a74f76b0c2406ccce1f73880819cacac |
Author: | stefan |
Category: | javax / ocr |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-15 01:10:38 |
Source code size: | 794 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 322 / 350 |
Version history: | 6 change(s) |
Referenced in: | [show references] |