When I follow the examples “Playing with Python” for the picar-x, none of the examples involving the camera work properly.
For example, in Example 7, Computer Vision, the camera takes and saves a very fuzzy photo. When I take another photo, it takes and saves a second photo, but the photo is the same as the first one. This happens again and again.
In Example 9, Record Video, the same thing happens again.
However, if I use the assembled picar as a raspberry pi5 with a SENSE Hat with instructions like ““rpicam-still -o test1.jpg” and “rpicam-vid -t 60000 test1.mp4”, the camera works perfectly, taking perfect pictures and videos.
Clearly the camera works perfectly, but the coding in the Sunfounder example modules appears to be incorrect. So what is the solution?
By the way, I am using a raspberry pi5 with Bookworm.
It is possible that there is a conflict between the system desktop and the video source. After you run the example code, the video display appears briefly and then automatically closes. When you later try to access the video stream via a browser, the screen appears frozen.
Please modify the code in the 7.display.py file, and then run the 7.display.py example again to see if the issue is resolved.
Change Vilib.display(local=True, web=True) to:
Vilib.display(local=False, web=True)
Save the changes, close the file, and then run the script (as shown in the image).
Similarly, modify the code in 9.record_video.py:
Change Vilib.display(local=True, web=True) to:
Vilib.display(local=False, web=True)
Save the changes, close the file, and then run the script (as shown in the image).
Thank you. The description in your first paragraph describes exactly what happens. I’ll try the modified code later today.
David