This repository has been archived by the owner on Sep 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
README noch unvollständig
- Loading branch information
Showing
6 changed files
with
2,706 additions
and
2 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
Fortschritt Impfzertifikat, live vom PI 4 mit PI OS lite | ||
|
||
In manchen Dokumenten ist ein Personal Access Token zu lesen. Deshalb kann dieses Repository in dieser Form vorerst(!) nicht veröffentlicht werden. | ||
Eine öffentliche Version wird folgen! | ||
|
||
## Ausrüstung | ||
|
||
RasPI 4, PI Camera v2, Ethernet, Monitor, Tastatur | ||
Image: PI OS Lite via [Raspberry Pi Imager](https://www.raspberrypi.com/software/) | ||
Auf dem PI: Alles als Root-User durchführen | ||
|
||
# Konfigschritte | ||
|
||
## notwendigerweise bekannte Git-Befehle | ||
|
||
### Initial | ||
|
||
``` sh | ||
- git init | ||
- git checkout branch | ||
- git clone | ||
- git pull | ||
``` | ||
|
||
``` | ||
git config --global user.name "Jonathan" | ||
git config --global user.email "26322754+nukerxy@users.noreply.github.com" | ||
git push | ||
``` | ||
|
||
wenn schon ein commit mit falschen Daten vorhanden: | ||
|
||
``` | ||
git commit --amend --reset-author | ||
``` | ||
### Aktuellen Stand speichern | ||
|
||
``` sh | ||
git checkout branch | ||
<Make some changes> | ||
git add . | ||
git commit -m "message" | ||
git push [-f] | ||
``` | ||
### Sonstige (Zeilen einzeln lesen) | ||
|
||
``` | ||
git status | ||
git reset | ||
git checkout -- file.extension | ||
git push --set-upstream origin branchname | ||
history > history.txt | ||
``` | ||
|
||
## Aktualisierung und Tools holen | ||
|
||
``` sh | ||
apt update | ||
apt upgrade | ||
apt install python3-pip git -y | ||
``` | ||
|
||
## Installation Repositories | ||
|
||
```sh | ||
cd /home/pi | ||
git clone https://github.com/panzi/verify-ehc | ||
cd /home/pi/verify-ehc | ||
pip3 install -r requirements.txt | ||
cd /home/pi/ | ||
git clone https://TOKEN@github.com/nukerxy/emb-impf.git | ||
pip3 install opencv-python | ||
``` | ||
(oder apt install python3-opencv) ? | ||
|
||
## Dependencies nachinstallieren | ||
|
||
``` sh | ||
apt install libqt4-test python3-sip python3-pyqt5 libqtgui4 libjasper-dev libatlas-base-dev | ||
``` | ||
und noch dazu: | ||
|
||
``` | ||
pip3 install opencv-contrib-python==4.1.0.25 | ||
apt install libzbar0 | ||
``` | ||
## Kamera einrichten | ||
|
||
``` sh | ||
raspi-config | ||
``` | ||
In GUI Kamera aktivieren --> Welche Änderung in File TODO | ||
|
||
ggf ist | ||
``` sh | ||
modprobe bcm2835_v4l2 / modprobe bcm2835-v4l2 | ||
``` | ||
nötig | ||
|
||
Es gab eine komische Fehlermeldung bei `modprobe bcm2835_v4l2` | ||
```sh | ||
modprobe: ERROR: ../libkmod/libkomd.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/5.10.17-71+/modules.dep.bin' | ||
modprobe: FATAL: MOdule bcm3825_v4l2 not found in directory /lib/modules/5.10.17-v71+ | ||
``` | ||
|
||
daher wurde | ||
``` sh | ||
apt install --reinstall raspberrypi-bootloader | ||
apt install --reinstall raspberrypi-kernel | ||
``` | ||
ausgeführt, das hat es soweit repariert. | ||
|
||
## Autostart | ||
|
||
``` sh | ||
cd /etc/init.d | ||
nano impfe.sh | ||
chmod 777 impfe.sh | ||
sudo update-rc.d impfe.sh defaults | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/usr/bin/env python3 | ||
import cv2 | ||
import numpy as np | ||
import sys | ||
import time | ||
import os | ||
from gpiozero import LED | ||
tstart=time.time() | ||
qrDecoder = cv2.QRCodeDetector() | ||
cap = cv2.VideoCapture(0) | ||
|
||
#on: program is running | ||
#off: qr_detected | ||
led_running_qr_detected = LED(17) # White, status | ||
|
||
#blinking 5 times rapidly: fail, output==[] | ||
led_detection_success_fail = LED(27) #yellow | ||
print("init") | ||
count=0 | ||
while True: | ||
if count<10: | ||
led_running_qr_detected.off() | ||
elif 10<=count<20: | ||
led_running_qr_detected.on() | ||
else: | ||
count=0 | ||
count=count+1 | ||
time.sleep(0.05) | ||
led_detection_success_fail.off() | ||
readsuccess, img = cap.read() | ||
# print("read image") | ||
detectionsuccess=False | ||
#tbeforedetect=time.time() | ||
|
||
if readsuccess: | ||
detectionsuccess,points = qrDecoder.detect(img) | ||
tafterdetect=time.time() | ||
else: | ||
print("read failed") | ||
for i in range(0,10): | ||
led_detection_success_fail.on() | ||
led_running_qr_detected.off() | ||
time.sleep(0.2) | ||
led_detection_success_fail.off() | ||
led_running_qr_detected.on() | ||
time.sleep(0.2) | ||
if detectionsuccess: | ||
led_running_qr_detected.on() | ||
print("detected") | ||
print("time since start: \n",tafterdetect-tstart) | ||
cv2.imwrite("qr_gelesen.jpeg", img) | ||
tafterwrite=time.time() | ||
#print("start:",tbeforedetect-tstart,"detect:",tafterdetect-tbeforedetect,"write",tafterwrite-tafterdetect) | ||
#time.sleep(1) | ||
# manually run first: run ./verify_ehc.py --certs-from AT,DE --save-certs trust_list.cbor | ||
# check if trust_list.cbor exists TODO | ||
commandstream=os.popen("cd /home/pi/verify-ehc/ && ./verify_ehc.py --image ../emb-impf/qr_gelesen.jpeg --certs-file trust_list.cbor") | ||
output=commandstream.readlines() # readlines has \n or something | ||
if output==[]: #yellow LED starts blinking | ||
for i in range(0,4): | ||
led_detection_success_fail.on() | ||
time.sleep(0.1) | ||
led_detection_success_fail.off() | ||
time.sleep(0.1) | ||
print("Error in barcodescanner.py: could not process qr code, try again!") | ||
# cv2.imwrite("latest_qr_process_error_"+str(tafterdetect-tstart)+".jpeg",img) | ||
cv2.imwrite("latest_qr_process_error.jpeg",img) | ||
else: | ||
#led_detection_success_fail.on() | ||
time.sleep(2) | ||
# print("output",output) | ||
print("completed") | ||
# print(commandstream.readlines()) | ||
commandstream.close() | ||
# TODO clean up this output | ||
# time.sleep(3) | ||
#else: | ||
#print("QR Code not detected") | ||
#time.sleep(0.01) | ||
#For debugging | ||
#cv2.imwrite("qr_notfound.jpeg",img) | ||
# cap.release() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
### BEGIN INIT INFO | ||
# Default-Start: 1 2 3 4 5 | ||
# Default-Stop: 0 6 | ||
### END INIT INFO | ||
. /lib/lsb/init-functions | ||
|
||
start(){ | ||
bash -c "cd /home/pi/emb-impf && ./barcodescanner.py" | ||
} | ||
|
||
stop(){ | ||
bash -c "killall python3" | ||
} | ||
|
||
case "$1" in | ||
start) | ||
start | ||
;; | ||
stop) | ||
stop | ||
;; | ||
*) | ||
exit 1 | ||
esac | ||
|
||
exit 0 |
Binary file not shown.
Oops, something went wrong.