Uses 1059K of libraries. Click here for Pure Java version (9634L/51K).
1 | !7 |
2 | |
3 | cmodule2 FindLineInCenter > DynWebCamAnalyzer {
|
4 | transient BWIntegralImage ii; |
5 | transient OCRCompass c; |
6 | switchable bool lineIsBright = true; |
7 | switchable int angles = 6; |
8 | switchable int radius = 50; |
9 | |
10 | start {
|
11 | dm_onFieldChange(ll("angles", "radius", "lineIsBright"),
|
12 | r { c = null });
|
13 | } |
14 | |
15 | // add controls |
16 | afterVisualize {
|
17 | containerAddFirst(buttons, dm_checkBox lineIsBright(), |
18 | dm_spinnerWithLabel angles(2, 24), dm_spinnerWithLabel radius(1, 80)); |
19 | } |
20 | |
21 | void prepareImage {
|
22 | ii = new BWIntegralImage(inputImage); |
23 | } |
24 | |
25 | void analyzeImage {
|
26 | Pt center = pt(w/2, h/2); |
27 | if (c == null || neq(c.center, center)) {
|
28 | c = new OCRCompass; |
29 | c.center = center; |
30 | c.steps = angles*2; |
31 | c.brightForeground = lineIsBright; |
32 | c.radius = min(w, h)/2.0*radius/100; |
33 | overlays = ll(c); |
34 | } |
35 | c.image = ii; |
36 | c.compute(); |
37 | } |
38 | } |
Began life as a copy of #1030561
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1030562 |
| Snippet name: | Web Cam / Central Compass [detects orientation of a line in the center of the image] |
| Eternal ID of this version: | #1030562/19 |
| Text MD5: | d721cea1f15afe10dc8a2672867cd1b1 |
| Transpilation MD5: | 1ad7411bbacfb8ab59410cfc4ff591c0 |
| Author: | stefan |
| Category: | javax / stefan's os / web cam / ocr |
| Type: | JavaX source code (Dynamic Module) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-01-10 14:52:59 |
| Source code size: | 929 bytes / 38 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 437 / 1354 |
| Version history: | 18 change(s) |
| Referenced in: | [show references] |