我很好地安装了 OpenALPR,并且能够在终端中运行它以获得以下结果:
C:\Users\zebsu>"C:\\OpenALPR\\Agent\\bin\\alpr.exe" "C:\\plate.jpg"
plate0: 3 results
State ID: us-oh (97% confidence)
- PZ65BYV confidence: 94.5181 pattern_match: 0
- P265BYV confidence: 81.1941 pattern_match: 0
- P65BYV confidence: 81.1336 pattern_match: 0
但是,我随后按照 PyPI ( https://pypi.org/project/openalpr/#description ) 上的说明安装 openalpr python 绑定pip install openalpr
。但是,当我使用 python 3.8.6 x64 运行他们建议的以下代码时:
import json
from openalpr import Alpr
alpr = Alpr("us", "C:/OpenALPR/Agent/etc/openalpr/openalpr.conf", "C:/OpenALPR/Agent/usr/share/openalpr/configruntime_data")
if not alpr.is_loaded():
print("Error loading OpenALPR")
sys.exit(1)
results = alpr.recognize_file("C:/image.jpg")
print(json.dumps(results, indent=4))
alpr.unload()
我收到以下错误:
Traceback (most recent call last):
File "C:\Users\zebsu\AppData\Local\Programs\Python\Python38\lib\site-packages\openalpr\openalpr.py", line 70, in __init__
self._openalprpy_lib = ctypes.cdll.LoadLibrary("libopenalpr.dll")
File "C:\Users\zebsu\AppData\Local\Programs\Python\Python38\lib\ctypes\__init__.py", line 451, in LoadLibrary
return self._dlltype(name)
File "C:\Users\zebsu\AppData\Local\Programs\Python\Python38\lib\ctypes\__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'libopenalpr.dll' (or one of its dependencies). Try using the full path with constructor syntax.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\zebsu\OneDrive\compuuter science\work\LPR\LPR_test.py", line 4, in <module>
alpr = Alpr("us", "C:/OpenALPR/Agent/etc/openalpr/openalpr.conf", "C:/OpenALPR/Agent/usr/share/openalpr/configruntime_data")
File "C:\Users\zebsu\AppData\Local\Programs\Python\Python38\lib\site-packages\openalpr\openalpr.py", line 80, in __init__
raise nex
OSError: Unable to locate the OpenALPR library. Please make sure that OpenALPR is properly installed on your system and that the libraries are in the appropriate paths.
如果我使用 python 3.6.8 x32 运行代码,这就是我得到的错误:
Traceback (most recent call last):
File "C:\Users\zebsu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\openalpr\openalpr.py", line 70, in __init__
self._openalprpy_lib = ctypes.cdll.LoadLibrary("libopenalpr.dll")
File "C:\Users\zebsu\AppData\Local\Programs\Python\Python36-32\lib\ctypes\__init__.py", line 426, in LoadLibrary
return self._dlltype(name)
File "C:\Users\zebsu\AppData\Local\Programs\Python\Python36-32\lib\ctypes\__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\zebsu\OneDrive\compuuter science\work\LPR\LPR_test.py", line 4, in <module>
alpr = Alpr("us", "C:/OpenALPR/Agent/etc/openalpr/openalpr.conf", "C:/OpenALPR/Agent/usr/share/openalpr/configruntime_data")
File "C:\Users\zebsu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\openalpr\openalpr.py", line 80, in __init__
raise nex
OSError: Unable to locate the OpenALPR library. Please make sure that OpenALPR is properly installed on your system and that the libraries are in the appropriate paths.
我已经搜索了所有互联网论坛以寻找答案,但是大多数提交都是几年前的,在 openalpr 绑定可以使用 pip 安装并且必须从 github 安装之前。有人有建议吗?