It can be useful to share credentials in a trusted manner.
Using Termux | qrencode -t UTF8 for instance.
QRCodeScanner.py:
fromcv2importVideoCapture,barcode,imshow,waitKey,destroyAllWindows#, QRCodeDetectorcap=VideoCapture(0)detector=barcode.BarcodeDetector()# QRCodeDetectorwhileTrue:_,img=cap.read()data,b,c=detector.detectAndDecode(img)# returns incorrect results most of time and other variables are still `None`...#print(pyzbar.decode(img)) # not betterifdata:print(data,b,c)a=databreakimshow('QR code scanner',img)ifwaitKey(1)==ord('q'):breakprint(a)cap.release()destroyAllWindows()
was taken on this Internet if I remember correctly.
It is stored on my Linux Mint 22.1 Cinnamon Framework 13 at /home/benjamin_loison/Desktop/bens_folder/dev/python/projects/QRCodeScanner/. Related to /home/benjamin_loison/Desktop/bens_folder/dev/python/projects/QRCodeReader/ taking an image like a screenshot if I remember correctly, see below.
It is quite slow and has not detected my QR code this time but it already happened significantly in the past.
It can be useful to share credentials in a trusted manner.
Using Termux `| qrencode -t UTF8` for instance.
<details>
<summary><code>QRCodeScanner.py</code>:</summary>
```python
from cv2 import VideoCapture, barcode, imshow, waitKey, destroyAllWindows#, QRCodeDetector
cap = VideoCapture(0)
detector = barcode.BarcodeDetector() # QRCodeDetector
while True:
_, img = cap.read()
data, b, c = detector.detectAndDecode(img) # returns incorrect results most of time and other variables are still `None`...
#print(pyzbar.decode(img)) # not better
if data:
print(data, b, c)
a = data
break
imshow('QR code scanner', img)
if waitKey(1) == ord('q'):
break
print(a)
cap.release()
destroyAllWindows()
```
</details>
was taken on this Internet if I remember correctly.
It is stored on my Linux Mint 22.1 Cinnamon Framework 13 at `/home/benjamin_loison/Desktop/bens_folder/dev/python/projects/QRCodeScanner/`. Related to `/home/benjamin_loison/Desktop/bens_folder/dev/python/projects/QRCodeReader/` taking an image like a screenshot if I remember correctly, see below.
It is quite slow and has not detected my QR code this time but it already happened significantly in the past.
Maybe could investigate with [scrcpy/blob/c5ed2cfc28ee7c7b59b11eb4db1258ac1c633bff/doc/v4l2.md](https://github.com/Genymobile/scrcpy/blob/c5ed2cfc28ee7c7b59b11eb4db1258ac1c633bff/doc/v4l2.md) to have better video stream.
<details>
<summary><code>QRCodeReader.py</code>:</summary>
```python
import os
from pyzbar.pyzbar import decode
from PIL import Image
path = 'Desktop/'
os.chdir(path)
print(decode(Image.open('qr.png')))
```
</details>
+7
Command 'zbarimg' not found, but can be installed with:
sudo apt install zbar-tools
sudo apt install -y zbar-tools
Output:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
zbarcam-gtk zbarcam-qt
The following NEW packages will be installed:
zbar-tools
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 36,1 kB of archives.
After this operation, 98,3 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main amd64 zbar-tools amd64 0.23.92-7+deb12u1 [36,1 kB]
Fetched 36,1 kB in 0s (123 kB/s)
Selecting previously unselected package zbar-tools.
(Reading database ... 276854 files and directories currently installed.)
Preparing to unpack .../zbar-tools_0.23.92-7+deb12u1_amd64.deb ...
Unpacking zbar-tools (0.23.92-7+deb12u1) ...
Setting up zbar-tools (0.23.92-7+deb12u1) ...
Processing triggers for dbus (1.14.10-1~deb12u1) ...
Processing triggers for man-db (2.11.2-2) ...
zbarimg --raw --quiet /dev/video0
ERROR: no decode delegate for this image format `' @ error/constitute.c/ReadImage/580
Same with /dev/video1 and without --raw and --quiet
zbarcam
shows webcam video stream in realtime and when present a QR code, then get in the console:
QR-Code:CENSORED
<details>
<summary>On my Debian 12 GNOME laptop:</summary>
```
-----BEGIN PGP MESSAGE-----
hF4DTQa9Wom5MBgSAQdAMVQFf77a6oKYevxY2/pj0G/fvKeg9ve/0JQxJPEIJ3gw
KBkFVgszpZ32GuV7EGwfXZN6ITX/S/AY4PHanZvtqHolZ0JbkiUl0Wi6PyA9wmhJ
1GABCQIQ/SGgYP5T1oCQEiX/md2SUjWYdoqOB+O00aQKZkuGoaxKnw3nd24mVh7q
S96PkWFB/oSBvOQ4BQTm+/BGxvzfQD8m/tEPBUdb2XTrOeo3I+B2vvesaL4nPdej
Nto=
=yGfY
-----END PGP MESSAGE-----
```
</details>
```
ls /dev/video*
```
```
/dev/video0 /dev/video1
```
```
zbarimg --raw --quiet /dev/video0
```
<details>
<summary>Output:</summary>
```
Command 'zbarimg' not found, but can be installed with:
sudo apt install zbar-tools
```
</details>
```
sudo apt install -y zbar-tools
```
<details>
<summary>Output:</summary>
```
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
zbarcam-gtk zbarcam-qt
The following NEW packages will be installed:
zbar-tools
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 36,1 kB of archives.
After this operation, 98,3 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main amd64 zbar-tools amd64 0.23.92-7+deb12u1 [36,1 kB]
Fetched 36,1 kB in 0s (123 kB/s)
Selecting previously unselected package zbar-tools.
(Reading database ... 276854 files and directories currently installed.)
Preparing to unpack .../zbar-tools_0.23.92-7+deb12u1_amd64.deb ...
Unpacking zbar-tools (0.23.92-7+deb12u1) ...
Setting up zbar-tools (0.23.92-7+deb12u1) ...
Processing triggers for dbus (1.14.10-1~deb12u1) ...
Processing triggers for man-db (2.11.2-2) ...
```
</details>
```
zbarimg --raw --quiet /dev/video0
```
```
ERROR: no decode delegate for this image format `' @ error/constitute.c/ReadImage/580
```
Same with `/dev/video1` and without `--raw` and `--quiet`
```
zbarcam
```
shows webcam video stream in realtime and when present a QR code, then get in the console:
```
QR-Code:CENSORED
```
zbarcam --oneshot | sed 's/QR-Code://'| head -c -1 | clip
works as wanted to put QR code scanner content without displaying it to the clipboard that way up to someone seeing the QR code which is quite easy due to screen video feedback, it is secret privacy friendly supporting.
```bash
zbarcam --oneshot | sed 's/QR-Code://' | head -c -1 | clip
```
works as wanted to put QR code scanner content without displaying it to the clipboard that way up to someone seeing the QR code which is quite easy due to screen video feedback, it is secret privacy friendly supporting.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libzbarqt0
The following NEW packages will be installed:
libzbarqt0 zbarcam-qt
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 91.2 kB of archives.
After this operation, 258 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main amd64 libzbarqt0 amd64 0.23.92-7+deb12u1 [43.1 kB]
Get:2 http://deb.debian.org/debian bookworm/main amd64 zbarcam-qt amd64 0.23.92-7+deb12u1 [48.0 kB]
Fetched 91.2 kB in 0s (453 kB/s)
Selecting previously unselected package libzbarqt0:amd64.
(Reading database ... 281245 files and directories currently installed.)
Preparing to unpack .../libzbarqt0_0.23.92-7+deb12u1_amd64.deb ...
Unpacking libzbarqt0:amd64 (0.23.92-7+deb12u1) ...
Selecting previously unselected package zbarcam-qt.
Preparing to unpack .../zbarcam-qt_0.23.92-7+deb12u1_amd64.deb ...
Unpacking zbarcam-qt (0.23.92-7+deb12u1) ...
Setting up libzbarqt0:amd64 (0.23.92-7+deb12u1) ...
Setting up zbarcam-qt (0.23.92-7+deb12u1) ...
Processing triggers for libc-bin (2.36-9+deb12u10) ...
on Debian 12 GNOME Sicily laptop live USB key.
zbarcam-qt
Output:
QSocketNotifier: Can only be used with threads started with QThread
Segmentation fault
sudo zbarcam-qt
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
```
sudo apt install -y zbarcam-qt
```
<details>
<summary>Output:</summary>
```
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libzbarqt0
The following NEW packages will be installed:
libzbarqt0 zbarcam-qt
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 91.2 kB of archives.
After this operation, 258 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main amd64 libzbarqt0 amd64 0.23.92-7+deb12u1 [43.1 kB]
Get:2 http://deb.debian.org/debian bookworm/main amd64 zbarcam-qt amd64 0.23.92-7+deb12u1 [48.0 kB]
Fetched 91.2 kB in 0s (453 kB/s)
Selecting previously unselected package libzbarqt0:amd64.
(Reading database ... 281245 files and directories currently installed.)
Preparing to unpack .../libzbarqt0_0.23.92-7+deb12u1_amd64.deb ...
Unpacking libzbarqt0:amd64 (0.23.92-7+deb12u1) ...
Selecting previously unselected package zbarcam-qt.
Preparing to unpack .../zbarcam-qt_0.23.92-7+deb12u1_amd64.deb ...
Unpacking zbarcam-qt (0.23.92-7+deb12u1) ...
Setting up libzbarqt0:amd64 (0.23.92-7+deb12u1) ...
Setting up zbarcam-qt (0.23.92-7+deb12u1) ...
Processing triggers for libc-bin (2.36-9+deb12u10) ...
```
</details>
on Debian 12 GNOME Sicily laptop live USB key.
```
zbarcam-qt
```
<details>
<summary>Output:</summary>
```
QSocketNotifier: Can only be used with threads started with QThread
Segmentation fault
```
</details>
```
sudo zbarcam-qt
```
```
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
```

Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
It can be useful to share credentials in a trusted manner.
Using Termux
| qrencode -t UTF8for instance.QRCodeScanner.py:was taken on this Internet if I remember correctly.
It is stored on my Linux Mint 22.1 Cinnamon Framework 13 at
/home/benjamin_loison/Desktop/bens_folder/dev/python/projects/QRCodeScanner/. Related to/home/benjamin_loison/Desktop/bens_folder/dev/python/projects/QRCodeReader/taking an image like a screenshot if I remember correctly, see below.It is quite slow and has not detected my QR code this time but it already happened significantly in the past.
Maybe could investigate with scrcpy/blob/c5ed2cfc28ee7c7b59b11eb4db1258ac1c633bff/doc/v4l2.md to have better video stream.
QRCodeReader.py:+7
DuckDuckGo and Google search Linux scan webcam QR code and qrscan GitHub.
DuckDuckGo search
"ERROR: no decode delegate for this image format".CoBang has 305 stars and last commit was last week.
https://www.reddit.com/r/linux/comments/vyshqm/comment/ig46a7t/
The Ask Ubuntu question 22871 raises this question.
Related to Benjamin_Loison/xclip/issues/1.
On my Debian 12 GNOME laptop:
Output:
Output:
Same with
/dev/video1and without--rawand--quietshows webcam video stream in realtime and when present a QR code, then get in the console:
Related to Benjamin_Loison/gnome-control-center/issues/48.
Could even make a tool to propose actions like Android when scan an arbitrary QR code, for instance to also just open a URL.
Output:
may help.
works as wanted to put QR code scanner content without displaying it to the clipboard that way up to someone seeing the QR code which is quite easy due to screen video feedback, it is secret privacy friendly supporting.
Related to Benjamin_Loison/Debian/issues/50.
Output:
on Debian 12 GNOME Sicily laptop live USB key.
Output:
Related to Benjamin_Loison/zbar/issues/6.