I can see that the camera is working on my PICAR-X because when I have it take a photo, it produces a file in the Pictures directory and it looks fine when I display it. However, whenever I try to have it do the QR Code Detect, it never returns, indicating that it is never detecting the QR code that I have in front of the camera. I have also had it take a picture of the QR code that I am using and the file that it produces of that also looks fine.
The QR code detection library used in the PiCar‑X example is designed for simpler QR codes and may not reliably detect complex or densely encoded ones.We recommend using a tool like QR.io to generate QR codes containing short text strings (e.g., a few words or a simple URL). This should work well with the PiCar‑X’s built‑in detection.
If you need to detect more complex QR codes (e.g., large amounts of data or custom encoding), you would need to explore alternative QR code libraries and implement them yourself
The QR code that I was using for testing is an extremely simple, sparse text code saying simply “Hello World! “, so no, that doesn’t explain it. I have attached a picture of that QR code.
I couldn’t reproduce your exact issue, but I did encounter another bug: the video stream at http://192.168.xxx.xxx:9000/mjpg would freeze when running the example code.
To fix this, change line 89 from:
Vilib.display(local=True, web=True)
to:
Vilib.display(local=False, web=True)
I suspect you may be experiencing the same issue – not that the QR code cannot be detected, but that the video frame is frozen.
Could you please provide more details? For example:Does the camera feed show movement when running the script?Are there any error messages in the terminal?Does the script detect other objects (e.g., faces or colours) normally?
Sorry that it took me so long to get back to you. That worked like a charm. In addition to the QR code detect working now, so do color and face detection.
We’re glad the fix worked and that QR code, colour, and face detection are all running smoothly now. If you run into any other questions, feel free to reach out.
I had a similar problem with the stare_at_you program. If I started the program with the camera pointed at my face, then it continuously adjusts the direction of the camera in one direction until it gets as far as it can. If I start the program with the camera not pointed at my face then it never adjusts the position of the camera, even after I point it at my face. Looking at the video output I can see why: the video never changes after the initial picture. This explains both behaviors. It keeps adjusting the position of the camera in one direction when initially pointed at my face because it is trying to center on my face and continuously thinks it is off by the same amount in the same direction. It also fails to ever adjust the position of the camera when it is not initially pointed at my face because it never sees my face, even after it is pointed at it.
The call to Vilib.display had no calling parameters included in stare_at_you so, similar to what you had me do in computer_vision, I added “local=False,web=True” to the call to Vilib.display in stare_at_you and that fixed the problem.
It looks like the video freezing issue is a common problem across several camera examples. I’ll find some time to update them all uniformly. Thank you for your feedback – it’s very helpful!