ナンバープレートの画像読み取りでは、
を行う
sudo cp /usr/share/tesseract-ocr/tessdata/jpn.traineddata ljp.traineddata cd /usr/share/openalpr/runtime_data/postprocess sudo cp us.patterns jp.patterns cd /usr/share/openalpr/runtime_data/config sudo cp us.conf jp.conf jp.xml を設定 (us.xml をコピー)
動作確認してみる.
cd <openalpr-2.3.0-win-64bit.zip を展開(解凍)したディレクトリ> alpr -c us samples\us-1.jpg
※ うまく認識できない場合は、「No license plate found.」と表示される。
元画像 samples\us-1.jpg を下に示す。
【関連する外部ページ】:https://github.com/openalpr/openalpr/tree/master/src/bindings/python
【サイト内の関連ページ】
【関連する外部ページ】
Python の公式ページ: https://www.python.org/
Windows での展開(解凍)に便利な 7-Zip: 別ページ »で説明している.
この .zip ファイルは,e:\Downloads\openalpr-master\openalpr-master に展開(解凍)したものとして,説明を続けるので,適切に読み替えてください.
e: cd e:\Downloads\openalpr-master\openalpr-master
cd src\bindings\python python setup.py install
python -m pip install -U numpy scipy
jupyter qtconsole
【Python の利用】
Python は,次のコマンドで起動できる.
Python 開発環境(Jupyter Qt Console, Jupyter ノートブック (Jupyter Notebook), Jupyter Lab, Nteract, Spyder, PyCharm, PyScripterなど)も便利である.
Python のまとめ: 別ページ »にまとめ
※ 「jupyter qtconsole」を入れたのに,jupyter qtconsole が起動しない という場合には,次の操作で,インストールを行ってから,もう一度試してみる.
python -m pip install -U jupyterlab jupyter jupyter-console jupytext spyder
from openalpr import Alpr alpr = Alpr("us", "/path/to/openalpr.conf", "/path/to/runtime_data") if not alpr.is_loaded(): print("Error loading OpenALPR") sys.exit(1) alpr.set_top_n(20) alpr.set_default_region("md") results = alpr.recognize_file("/path/to/image.jpg") i = 0 for plate in results['results']: i += 1 print("Plate #%d" % i) print(" %12s %12s" % ("Plate", "Confidence")) for candidate in plate['candidates']: prefix = "-" if candidate['matches_template']: prefix = "*" print(" %s %12s%12f" % (prefix, candidate['plate'], candidate['confidence'])) # Call when completely done to release memory alpr.unload()
Windows のshisutemu 環境変数 TESSDATA_PREFIX C:\Program Files (x86)\Tesseract-OCR\tessdataに設定
3.04, 3.05 用のデータは、次のWebページからダウンロード. ファイル名は jpn.traineddata
C:\Program Files (x86)\Tesseract-OCR\tessdata
OpenALPR の Web ページ
https://github.com/rykov8/ssd_keras
この Web ページで「」