amount, currency, date, reference, account works
This commit is contained in:
parent
1f5b32029e
commit
8979b754dd
30
ocr.sh
30
ocr.sh
@ -2,4 +2,32 @@
|
||||
|
||||
|
||||
INPUT_IMAGE=$1
|
||||
tesseract $INPUT_IMAGE stdout
|
||||
|
||||
raw_text=$(tesseract $INPUT_IMAGE stdout)
|
||||
|
||||
referece=$(echo "$raw_text" | grep -o 'BLAZ[0-9]*')
|
||||
to_number=$(echo "$raw_text" | grep -oE '\b9[0-9]{16}\b|\b7[0-9]{12}\b')
|
||||
date=$(echo "$raw_text" | grep -oE '\b[0-3][0-9]/[0-1][0-9]/[0-9]{4}\b')
|
||||
time=$(echo "$raw_text" | grep -oE '\b[0-2][0-9]:[0-5][0-9]\b')
|
||||
currency=$(echo "$raw_text" | grep -oP '(?<=Amount\s)[A-Z]{3}')
|
||||
amount=$(echo "$raw_text" | grep -oP '(?<=Amount\s[A-Z]{3}\s)[0-9]{1,3}(?:,[0-9]{3})*(?:\.[0-9]{2})')
|
||||
|
||||
json_output=$(cat <<EOF
|
||||
{
|
||||
"Amount": "$amount",
|
||||
"Currency": "$currency",
|
||||
"Date": "$date $time",
|
||||
"From": "$from",
|
||||
"Message": "$message",
|
||||
"referece": "$referece",
|
||||
"Remarks": "$remarks",
|
||||
"Status": "$status",
|
||||
"To": {
|
||||
"Account": "$to_number",
|
||||
"Name": "$to_name"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
echo $json_output
|
||||
|
12
ocr_raw.sh
Executable file
12
ocr_raw.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
INPUT_IMAGE=$1
|
||||
|
||||
raw_text=$(tesseract $INPUT_IMAGE stdout)
|
||||
|
||||
echo $raw_text
|
||||
echo ""
|
||||
echo +++real raw+++
|
||||
echo ""
|
||||
tesseract $INPUT_IMAGE stdout
|
Loading…
x
Reference in New Issue
Block a user