User Tools

Site Tools


iot:spz

OpenALPR (get image)

while [ 1 ]
do
wget --quiet http://@192.168.1.1/Streaming/channels/1/picture --output-document=/tmp/snapshot.jpg
status=$(alpr -c eu -p cz -n 5 -j /tmp/snapshot.jpg | grep confidence)
if [ "$status" != "" ]; then
curl --header "Content-Type: application/json" --request POST --data "$status"  https://{endpoint}
fi
sleep 2
done
#!/bin/bash
nohup /opt/spz/spz.sh &>/dev/null &

Install OpenALPR

sudo add-apt-repository ppa:xapienz/curl34
sudo apt-get update
sudo apt install -y libtool m4 automake cmake pkg-config libopencv-dev liblog4cplus-1.1-9 liblog4cplus-dev build-essential libcurl4 libcurl4-openssl-dev beanstalkd

cd /usr/src
wget https://github.com/DanBloomberg/leptonica/archive/1.82.0.tar.gz
tar -xvzf 1.82.0.tar.gz
cd leptonica-1.82.0
./autogen.sh
./configure
sudo make
sudo make install

cd /usr/src
wget https://github.com/tesseract-ocr/tesseract/archive/4.1.3.tar.gz
tar -xvzf 4.1.3.tar.gz
cd tesseract-4.1.3/
./autogen.sh
./configure --enable-debug LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include"
sudo make
sudo make install
sudo ldconfig
tesseract --version

cd /usr/src
git clone https://github.com/openalpr/openalpr.git
cd openalpr/src
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc ..
make && sudo make install

openalpr.conf

contrast_detection_threshold = 0.3
skip_detection = 0
max_plate_width_percent = 100
max_plate_height_percent = 100

alrpd.conf

[daemon]
country = eu
pattern = cz
stream = rtsp://CAMERA_IP/Streaming/channels/4
site_id = plzen
company_id = company
store_plates = 0
store_plates_location = /opt/
analysis_threads = 2
topn = 1
upload_data = 1
upload_address = https://JSON_POST_URL
iot/spz.txt · Last modified: 2022/01/20 15:55 by Jan Forman