Number Plate Recognition - OpenALPR

Hey All,

Thought i would show this, but it’s still work in progress,

I know there is some native openalpr integration but i have created a separate solution that allows me to split up my workloads.

In the below repo is a container that runs the latest openalpr lib and will monitor a video stream and recognise number plates. When it recognises one that is in an array it will call the HA API Locally and fire a script called script.anpr. For me this script opens my drive way gates.

Feel free to take a look;
https://github.com/samtwilliams/ha-openalpr.

Sam

3 Likes

Hi Sam,

Is there any way to get this to work on Hassio which is currently running on Virtual box?
I’m interested in having some sort of ANPR solution to open my garage doors when I approach the house.

Cheer

Hey,

Can you not get Docker running? on your virtual box? Doesn’t mater if its a Linux or Windows OS as long as docker runs, That’s the easiest way. There is an issue with one of the libraries running direct on a windows guest.

Someone has docker running on Virtual box here;

Sam

Have it working in docker that has alpine as base image.

#Adding of dependencies
echo “http://nl.alpinelinux.org/alpine/edge/testing” >>/etc/apk/repositories && echo -e “http://dl-cdn.alpinelinux.org/alpine/edge/community\nhttp://dl-cdn.alpinelinux.org/alpine/edge/main” >> /etc/apk/repositoriesapk --no-cache add --virtual .build-deps ca-certificates wget git gcc g++ cmake make curl-dev leptonica-dev log4cplus-dev opencv-dev tesseract-ocr-dev libexecinfo-dev
#Cloning and making of directories
cd /srv && git clone https://github.com/openalpr/openalpr.git && cd openalpr/src && mkdir build && cd build && sed -i.bak ‘s/backtrace/0;///’ …/daemon.cpp
#building
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc … && make -j8 && make install

as for using it, openalpr config does not work but a workaround from gavinwoolley here makes it usable. OpenALPR local not working

If you need help editing config etc just reach out.

Hi Sam,

Is it possible to run this container twice? As I have two cams on two different driveways. Can you help me with that?

Thanks!

can you generate pull request and ill merge it

Hey Paul,

Yer don’t see why not. Just run two instances with different container names. edit the stream url in each.

Hey Sam,

When I try to build the docker container I get an error wich I cant seem to fix. Googled it and tried a lot like installing skbuild or reinstalling python but the error doesn’t disappear, any tips?

I enter this code:

docker build -t openalpr https://github.com/samtwilliams/ha-openalpr.git

And at step 11/19 I get this error?

Step 11/19 : RUN pip3 install opencv-python
 ---> Running in d78171be5a4b
Collecting opencv-python
  Downloading https://files.pythonhosted.org/packages/bb/08/9dbc183a3ac6baa95fabf749ddb531bd26256edfff5b6c2195eca26258e9/opencv-python-4.5.1.48.tar.gz (88.3MB)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-lvbbiguj/opencv-python/setup.py", line 10, in <module>
        import skbuild
    ModuleNotFoundError: No module named 'skbuild'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-lvbbiguj/opencv-python/
The command '/bin/sh -c pip3 install opencv-python' returned a non-zero code: 1
r

Other containers run without problems. Any thoughts?

Thanks!