You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -123,6 +123,7 @@ All options can be set via CLI flags or environment variables. Flags take preced
123
123
| `--crop` | `CROP` | *(disabled)* | Crop rectangle as `x0,y0,x1,y1` applied before OCR |
124
124
| `--ocr-match-regex` | `OCR_MATCH_REGEX` | `^000\d+$` | Regex to identify the meter reading from OCR text |
125
125
| `--ocr-fix-regex` | `OCR_FIX_REGEX` | *(disabled)* | Comma-separated list of regex substitutions as `pattern=replacement` applied in order before matching (e.g. `^O=0,^030=000`) |
126
+
| `--ocr-merge-texts` | `OCR_MERGE_TEXTS` | `false` | Concatenate all OCR text results into a single string before applying fix/match regexes (useful when readings are split across multiple detections, e.g. `["00036", "128"]` → `"00036128"`) |
126
127
| `--ocr-mask-regions` | `OCR_MASK_REGIONS` | *(disabled)* | Comma-separated rectangle coordinates to mask before OCR, as `x1,y1,x2,y2[,x3,y3,x4,y4,...]` (applied after crop) |
127
128
| `--ocr-mask-colors` | `OCR_MASK_COLORS` | `000000` | Comma-separated hex colors for mask regions. One color applies to all; otherwise must match the number of regions |
Copy file name to clipboardExpand all lines: main.go
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,7 @@ var (
31
31
mqttDeviceModelstring
32
32
meterDivisorfloat64
33
33
ocrIncrOnlybool
34
+
ocrMergeTextsbool
34
35
)
35
36
36
37
funcmain() {
@@ -77,6 +78,11 @@ func main() {
77
78
Usage: "Comma-separated list of regex substitutions applied to OCR text before matching, each as pattern=replacement (e.g. ^O=0,^030=000)",
78
79
Sources: cli.EnvVars("OCR_FIX_REGEX"),
79
80
},
81
+
&cli.BoolFlag{
82
+
Name: "ocr-merge-texts",
83
+
Usage: "Concatenate all OCR text results into a single string before applying fix/match regexes (useful when readings are split across multiple detections)",
84
+
Sources: cli.EnvVars("OCR_MERGE_TEXTS"),
85
+
},
80
86
&cli.StringFlag{
81
87
Name: "ocr-mask-regions",
82
88
Usage: "Comma-separated rectangle coordinates to mask before OCR, as x1,y1,x2,y2[,x3,y3,x4,y4,...] (applied after crop)",
0 commit comments