Installing openalpr module

0

Good evening developers. I need to download a module for Python, but I'm not getting it, I searched the internet and especially in StackOverflow in English, but it did not help, if anyone can help me I'll be grateful.

Edit:
Since yesterday I was trying to install the module in the notebook, I tried to install via pip, and getting the package from Git, extracted the file, opened the CMD and went and installed correctly, however when I was going to execute the file gave module problem not found , so I went to try again bit now and the module passed, however other errors were found, I will be leaving images

Click Run to see some images:

<html>
  <head></head>
  <body>

    <blockquote class="imgur-embed-pub" lang="en" data-id="MdQcTwd"><a href="//imgur.com/MdQcTwd">View post on imgur.com</a></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>

<blockquote class="imgur-embed-pub" lang="en" data-id="udwI9Ap"><a href="//imgur.com/udwI9Ap">View post on imgur.com</a></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>
  </body>
</html>

Edit2:
At the request of @Sidon error code:

    Traceback (most recent call last):
  File "C:\Users\Andreza\AppData\Local\Programs\Python\Python35\lib\site-packages\openalpr\openalpr.py", line 48, in __init__
    self._openalprpy_lib = ctypes.cdll.LoadLibrary("libopenalprpy.dll")
  File "C:\Users\Andreza\AppData\Local\Programs\Python\Python35\lib\ctypes\__init__.py", line 425, in LoadLibrary
    return self._dlltype(name)
  File "C:\Users\Andreza\AppData\Local\Programs\Python\Python35\lib\ctypes\__init__.py", line 347, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] Não foi possível encontrar o módulo especificado

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Andreza\Desktop\asdasd.py", line 3, in <module>
    alpr = Alpr("us", "/path/to/openalpr.conf", "/path/to/runtime_data")
  File "C:\Users\Andreza\AppData\Local\Programs\Python\Python35\lib\site-packages\openalpr\openalpr.py", line 58, 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.

Module: openalpr

    
asked by anonymous 10.04.2017 / 04:20

1 answer

1

Openalpr itself is a binary package developed in C (and other languages) and, optionally, a webservice. This package binds with several languages, including python.

Att: Examples in this answer are based on Linux (Debian).

documentation says there are 2 ways you can integrate OpenALPR with your application:

  • Use commercial DFK to compile OpenALPR libraries within of your application and render image frames individually;

  • Run the OpenALPR Agent executable to directly capture feeds and send the results of the cards and pictures to your application.

  

Commercial SDK

Windows, download it here:
link

Linux:

bash <(curl http://deb.openalpr.com/install)

Binding in the SDK:

Make the repository clone:

git clone https://github.com/openalpr/openalpr.git

Installation:

cd openalpr/src/bindings/python/
python setup.py install 

use

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()
  

Webserver

A second option is to use it as a web-server, in which case documentation recommends using ubuntu 16.04, so you can run the web-server, if that option is better study the documentation and, anyway, you will have to use part of the third option then.

  

CloudAPI

The third option is perhaps the most "easy", is the use of the API "in the clouds" of faces:

The OpenALPR Cloud API is a service running in the cloud that is ready to analyze your images. The service receives image data and responds with license plate information, as well as vehicle color, make, and model.

For this option, subscribe to the service (Free for 2000 acknowledgments / month), install api python and read the documentation >.

Download cloudapi

git clone https://github.com/openalpr/cloudapi.git

Install in python

cd cloudapi/python
pip install -r requirements.txt
sudo python setup.py install

To use

>>> import openalpr_api

REFERENCE
Official Documentation

    
10.04.2017 / 15:33