Upload 10 files
Browse files- .gitattributes +5 -0
- id_ocr/engine/header.py +47 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
id_ocr/dependency/libimutils.so filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
id_ocr/dependency/libimutils.so_for_ubuntu22 filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
id_ocr/engine/libMetaChecker.so filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
id_ocr/engine/libOCR.so filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
id_ocr/engine/libttvcore.so filter=lfs diff=lfs merge=lfs -text
|
id_ocr/engine/header.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import sys
|
| 3 |
+
import numpy as np
|
| 4 |
+
import ctypes, ctypes.util
|
| 5 |
+
from enum import Enum
|
| 6 |
+
from ctypes import *
|
| 7 |
+
from numpy.ctypeslib import ndpointer
|
| 8 |
+
|
| 9 |
+
def print_log(fmt): print("[LOG] \033[98m{}\033[00m" .format(fmt))
|
| 10 |
+
def print_info(fmt): print("[INFO] \033[92m{}\033[00m" .format(fmt))
|
| 11 |
+
def print_error(fmt): print("[ERR] \033[91m{}\033[00m" .format(fmt))
|
| 12 |
+
def print_warning(fmt): print("[WARNING] \033[93m{}\033[00m" .format(fmt))
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
ocr_path = os.path.abspath(os.path.dirname(__file__)) + '/libOCR.so'
|
| 16 |
+
ocr_engine = cdll.LoadLibrary(ocr_path)
|
| 17 |
+
|
| 18 |
+
get_deviceid = ocr_engine.TTVOcrGetHWID
|
| 19 |
+
get_deviceid.argtypes = []
|
| 20 |
+
get_deviceid.restype = ctypes.c_char_p
|
| 21 |
+
|
| 22 |
+
set_activation = ocr_engine.TTVOcrSetActivation
|
| 23 |
+
set_activation.argtypes = []
|
| 24 |
+
set_activation.restype = ctypes.c_char_p
|
| 25 |
+
|
| 26 |
+
init_sdk = ocr_engine.TTVOcrInit
|
| 27 |
+
init_sdk.argtypes = [ctypes.c_char_p]
|
| 28 |
+
init_sdk.restype = ctypes.c_char_p
|
| 29 |
+
|
| 30 |
+
ocr_id_card = ocr_engine.TTVOcrProcess
|
| 31 |
+
ocr_id_card.argtypes = [ctypes.c_char_p, ctypes.c_char_p]
|
| 32 |
+
ocr_id_card.restype = ctypes.c_char_p
|
| 33 |
+
|
| 34 |
+
ocr_credit_card = ocr_engine.TTVOcrCreditCard
|
| 35 |
+
ocr_credit_card.argtypes = [ctypes.c_char_p]
|
| 36 |
+
ocr_credit_card.restype = ctypes.c_char_p
|
| 37 |
+
|
| 38 |
+
ocr_barcode = ocr_engine.TTVOcrBarCode
|
| 39 |
+
ocr_barcode.argtypes = [ctypes.c_char_p]
|
| 40 |
+
ocr_barcode.restype = ctypes.c_char_p
|
| 41 |
+
|
| 42 |
+
metacheck_path = os.path.abspath(os.path.dirname(__file__)) + '/libMetaChecker.so'
|
| 43 |
+
meta_engine = cdll.LoadLibrary(metacheck_path)
|
| 44 |
+
|
| 45 |
+
check_meta = meta_engine.ttv_if_checker
|
| 46 |
+
check_meta.argtypes = [ctypes.c_char_p]
|
| 47 |
+
check_meta.restype = ctypes.c_int32
|