Libraryless. Click here for Pure Java version (7592L/51K).
1 | static int ocr_recognizeMultiLine_scored_maxPixels = 100000; |
2 | sbool ocr_recognizeMultiLine_scored_filterByMinScore; |
3 | static int ocr_recognizeMultiLine_scored_g = 3; |
4 | |
5 | static L<RecognizedText> ocr_recognizeMultiLine_scored(RGBImage img) { |
6 | BWImage bw = new BWImage(img); img = null; ret ocr_recognizeMultiLine_scored(bw); |
7 | } |
8 | |
9 | static L<RecognizedText> ocr_recognizeMultiLine_scored(BufferedImage img) { |
10 | BWImage bw = new BWImage(img); img = null; ret ocr_recognizeMultiLine_scored(bw); |
11 | } |
12 | |
13 | static L<RecognizedText> ocr_recognizeMultiLine_scored(BWImage bw) { |
14 | SimpleRecognizer sr = filledSimpleRecognizer_cached(); |
15 | enableFullSearchInSimpleRecognizer(sr); |
16 | ret ocr_recognizeMultiLine_scored(bw, sr); |
17 | } |
18 | |
19 | static L<RecognizedText> ocr_recognizeMultiLine_scored(final BWImage bw, final SimpleRecognizer sr) { |
20 | ret ocr_recognizeMultiLine_scored(bw, sr, autoSegment(bw, ocr_recognizeMultiLine_scored_g)); |
21 | } |
22 | |
23 | static L<RecognizedText> ocr_recognizeMultiLine_scored(final BWImage bw, L<Rect> _rects) { |
24 | ret ocr_recognizeMultiLine_scored(bw, simpleRecognizer(), _rects); |
25 | } |
26 | |
27 | static L<RecognizedText> ocr_recognizeMultiLine_scored(final RGBImage rgb, L<Rect> _rects) { |
28 | ret ocr_recognizeMultiLine_scored(new BWImage(rgb), _rects); |
29 | } |
30 | |
31 | static L<RecognizedText> ocr_recognizeMultiLine_scored(BufferedImage img, L<Rect> _rects) { |
32 | ret ocr_recognizeMultiLine_scored(new BWImage(img), _rects); |
33 | } |
34 | |
35 | static L<RecognizedText> ocr_recognizeMultiLine_scored(final BWImage bw, final SimpleRecognizer sr, L<Rect> _rects) { |
36 | final L<Rect> rects = dropRectsLargerThan(ocr_recognizeMultiLine_scored_maxPixels, _rects); |
37 | |
38 | /*new L<RecognizedText> lines; |
39 | for (Rect r : rects) |
40 | lines.add(RecognizedText(r, sr.recognizeScored(bw.clip(r)))); |
41 | ret lines;*/ |
42 | |
43 | L<RecognizedText> l = parallelMap2(rects, func(Rect r) -> RecognizedText { |
44 | //print(sysNow() + " " + currentThreadID() + rectPixels(r)); |
45 | ret RecognizedText(r, sr.recognizeScored(bw.clip(r))); |
46 | }); |
47 | if (ocr_recognizeMultiLine_scored_filterByMinScore) |
48 | l = ocr_filterByMinScore(l); |
49 | else |
50 | ocr_clearLinesBelowMinScore(l); |
51 | ret l; |
52 | } |
Began life as a copy of #1006333
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: | #1015273 |
Snippet name: | ocr_recognizeMultiLine_scored |
Eternal ID of this version: | #1015273/28 |
Text MD5: | c4f6c4bbd0829bfadbaa1366169b2870 |
Transpilation MD5: | c69dad0a8c0295677756574939a1b926 |
Author: | stefan |
Category: | javax / ocr |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-09-05 23:11:15 |
Source code size: | 2142 bytes / 52 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 448 / 551 |
Version history: | 27 change(s) |
Referenced in: | [show references] |