-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy patheasyprpy.py
More file actions
31 lines (26 loc) · 829 Bytes
/
easyprpy.py
File metadata and controls
31 lines (26 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- coding: utf-8 -*-
import platform
import ctypes
import os
def suffix():
sysstr=platform.system()
if(sysstr == "Windows"):
return ".dll"
elif(sysstr == "Darwin"):
return ".dylib"
else:
return ".so"
def initeasyprpy():
pathdll=os.path.split(os.path.realpath(__file__))[0]
Suffix=suffix()
easypr=ctypes.CDLL(os.path.join(pathdll+"/easyprexport"+Suffix))
easypr.plateRecognize.restype=ctypes.c_char_p
return easypr
class EasyPR:
Geasypr=initeasyprpy()
def __init__(self, modelpath):
self.ptr=EasyPR.Geasypr.init(os.path.join(modelpath))
def plateRecognize(self,data,lendata):
return EasyPR.Geasypr.plateRecognize(self.ptr,data,lendata)
def __del__(self):
EasyPR.Geasypr.deleteptr(self.ptr)