This lets you use a webcam to scan QR codes, and POSTs the scanned ids to the library server.
sudo apt-get install libzbar0 libjpeg8-dev python-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev python-numpy subversion libportmidi-dev ffmpeg libswscale-dev libavformat-dev libavcodec-dev
pip install -r requirements.txt
python main.py <LIBRARY HOST>
We're using C920 webcams which have a very sensitive autofocus.
I recommend disabling autofocus:
v4l2-ctl -c focus_auto=0
Then manually setting the focus:
v4l2-ctl -c focus_absolute=20
For reference: v4l2-ctl -l
If your video device is one other than /dev/video0
, use the -d
flag to specify it.
We're running this off of Raspberry Pis.
When SSH'd into the Pi, to launch properly:
export DISPLAY=:0
python3 main.py
If you need to wake the Pi's screen:
export DISPLAY=:0
xset s reset
The Raspberry Pi's default DNS may be non-ideal, making API calls slow. To change the Pi's DNS servers, edit /etc/resolv.conf
as root. Edit it to look like:
# Generated by resolvconf
nameserver 8.8.8.8
nameserver 8.8.4.4
Alternately, run sudo ./setdns.sh
, which will do the above.
NOTE: DNS will reset upon boot.
The file will try to read from pisettings.py
. See pisettings.py.example
for an example of what it looks like.
If pisettings.py
exists, it will read from pisettings["rotateangle"] and rotate the screen correspondingly.
This is so that each checkout station can have its video feed rotated to be more intuitive.