Real Time Scanning and Storing QR Codes With Raspberry Pi and OpenCV

Hey everyone, just put the finishing touches on Real Time Scanning and Storing QR Codes With Raspberry Pi and OpenCV

This guide focuses on QR (Quick Response) Codes and decoding them live with a Raspberry Pi. These codes are absolutely everywhere in our modern world and for great reason. Sharing a lot of similarities to barcodes, but instead of a laser, a camera is used to identify spaces between black and white squares markings. Encoding data this way is incredibly useful and, with machine learning, it has never been easier to decode their secrets.

All scripts dived into here will display decoded QR data live, one will also capture the information into a text file and the final will use specific QR codes to control the GPIO. There are lots of standards and types of QR codes but this system will work with all common types.

Read more

4 Likes

Hello,
I am following this tutorial, [How To Scan QR Codes With A Raspberry Pi + OpenCV - YouTube].
getting this error :
Overload resolution failed: > - Can’t parse ‘pt1’. Sequence item with index 0 has a wrong type

2 Likes

At which point are you getting this error?

After running the code It’ll open camera preview window and then I’m getting that error

2 Likes

Heyya mate,

What camera module and what version of Raspberry Pi OS are you utilising?

2 Likes

Hello,
I am using raspberry pi buster and camera : I have two different cameras, Raspberry pi high quality camera and Raspberry pi NoIR camera.

3 Likes

Let’s use that HQ camera to do some troubleshooting. What happens when you type and enter the below into your terminal?

raspistill -t 0

If that doesn’t work make sure to enable the camera in the Raspberry Pi Configuration Menu. Then hit the system with a reboot

2 Likes

Nothing happens after using raspbistill -t 0 but it clicks a picture when I use
raspistill -o Desktop/image.jpg command.

1 Like

Nothing will happen if that’s what you typed :stuck_out_tongue:

1 Like

raspistill*

1 Like

Hello! I cannot seem to find the code for this on the download sections, is there any link I can go to for me to see the codes? Thanks

2 Likes

Hi Reviwo,

Uh oh! It looks like when we switched over to our shiny new website those links were lost in the wash!

I’ve let the appropriate team know, and they should be back soon.

-James

3 Likes

Hi Reviwo,

Thanks for letting us know!
While we get the content ported over into the Tutorial, the attachments for this tutorial are available as a download by clicking on this link.

Liam

2 Likes

Thank you so much for all your help. Looking forward to coding this :slight_smile:

2 Likes

Hello! When I try to run the script, I’ve got multiple scan, but the time doesn’t change, any help with this?
image

1 Like

Heyya mate, does the time not change at all? Or is that just multiple scans all happening in rapid succession?

1 Like

sometimes it doubles and triples scan, but in that photo i tried to scan it for a couple of time, meaning the “seconds” should have changed a bit.

Hey, what does the following packages that I have downloaded on my Raspberry Pi mean? What are they good for?
sudo apt-get update

sudo apt-get install python3-opencv

I don’t understand this part at all:

sudo apt-get install libqt4-test python3-sip python3-pyqt5 libqtgui4 libjasper-dev libatlas-base-dev -y

pip3 install opencv-contrib-python==4.1.0.25

sudo modprobe bcm2835-v4l2

1 Like

Heyya Sandra,

The first line is a simple method to update all current packages on your computer.

The majority of the next Terminal Commands are installation methods for packages for Python to increase its functionality. Second, third, and fourth are all package installation lines. The third line looks a touch confusing because it actually installs 6 packages all at once. If you are interested in exactly what each package (and about the authors of them) you can find them at | pypi.org |. For instance here is the details on the | python3-pyqt5 | package installed when you run the third line - PyQt5 · PyPI

The final line is a firmware/driver required to make the PiCamera work with the Raspberry Pi. If that loads correctly, your should be able to access the video feed from the camera in OpenCV.

Hope this helps,
Tim

1 Like

Hello, I dont know how to express how stoked I am to have found this page. I am very new to the Raspberry Pi but have discovered it as a potential solution to something I am working on.

I am running the Latest OS and hoping i dont have to erase and jump back to a previous OS.

When I try to enter pip3 install opencv-contrib-python==4.1.0.25 into the terminal i get an Error message. Any suggestions? If i have to start over with an older OS i.e. “Buster” how do I upload this using a Mac computer?

2 Likes