I am getting acquainted with my new Picar-x. All was going well until project 7, computer_vision. I am not getting the specified promp. Instead I get this:
tTraceback (most recent call last):
File “/home/bobshafer/picar-x/example/7.computer_vision.py”, line 2, in
from vilib import Vilib
File “/usr/local/lib/python3.13/dist-packages/vilib/init.py”, line 2, in
from .vilib import Vilib
File “/usr/local/lib/python3.13/dist-packages/vilib/vilib.py”, line 182, in
class Vilib(object):
…<635 lines>…
return img
File “/usr/local/lib/python3.13/dist-packages/vilib/vilib.py”, line 184, in Vilib
picam2 = Picamera2()
File “/usr/lib/python3/dist-packages/picamera2/picamera2.py”, line 341, in init
camera_num = self.global_camera_info()[camera_num][‘Num’]
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
IndexError: list index out of range..
I reinstalled the camera cable. Any help would be appreciated.
It does look as if your camera is not correctly connected.
What does the simpler
rpicam-hello
say?
This doesn’t require any Sunfounder libraries nor picar hardware. Just the rpi and camera.
I’ve seen similar issues so many times on this forum that I’m starting to think that sunfounder could add a quick connectivity check between the camera and rpi before any assembly or library installation takes place, just for the user to be able to visualise and verify the final correct connections. This could save a lot of rebuilds IMHO
bobshafer@Picar:~/picar-x/example $ sudo python3 7.computer_vision.py
vilib 0.3.18 launching …
picamera2 0.3.34
Thanks for getting back to me. I am sorry to be so slow responding. I am new to forums. Following is the command responses.
Traceback (most recent call last):
File “/home/bobshafer/picar-x/example/7.computer_vision.py”, line 2, in
from vilib import Vilib
File “/usr/local/lib/python3.13/dist-packages/vilib/init.py”, line 2, in
from .vilib import Vilib
File “/usr/local/lib/python3.13/dist-packages/vilib/vilib.py”, line 182, in
class Vilib(object):
…<635 lines>…
return img
File “/usr/local/lib/python3.13/dist-packages/vilib/vilib.py”, line 184, in Vilib
picam2 = Picamera2()
File “/usr/lib/python3/dist-packages/picamera2/picamera2.py”, line 341, in init
camera_num = self.global_camera_info()[camera_num][‘Num’]
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
IndexError: list index out of range
bobshafer@Picar:~/picar-x/example $
bobshafer@Picar:~/picar-x/example $ rpicam-hello
[0:22:11.301316397] [2416] INFO Camera camera_manager.cpp:340 libcamera v0.7.0+rpt20260205
Made X/EGL preview window
Made DRM preview window
Preview window unavailable
ERROR: *** no cameras available ***
bobshafer@Picar:~/picar-x/example $
Please run the command i previously suggested, rpicam-hello.
That isolates the camera from the scenario. No other library dependencies etc.
However, it still looks like your camera is not connected. The above command will verify this. Usually in these scenarios, the camera cable is rotated 180’ at one or both ends, ive also seen it connected to the dsi not the csi port. If you can post close up photos of both ends, sunfounder should be able to see any issues immediately.
Here is the response to rpicam-hello. Please see second message at end. Thanks.
bobshafer@Picar:~/picar-x/example $ rpicam-hello
[0:03:39.480607038] [2000] INFO Camera camera_manager.cpp:340 libcamera v0.7.0+rpt20260205
[0:03:39.686814553] [2004] INFO IPAProxy ipa_proxy.cpp:180 Using tuning file /usr/share/libcamera/ipa/rpi/vc4/ov5647.json
[0:03:39.706671114] [2004] INFO Camera camera_manager.cpp:223 Adding camera ‘/base/soc/i2c0mux/i2c@1/ov5647@36’ for pipeline handler rpi/vc4
[0:03:39.706884537] [2004] INFO RPI vc4.cpp:445 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media0 and ISP device /dev/media1
[0:03:39.707005675] [2004] INFO RPI pipeline_base.cpp:1117 Using configuration file ‘/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml’
Made X/EGL preview window
Made DRM preview window
Preview window unavailable
Mode selection for 1296:972:12:P
SGBRG10_CSI2P,640x480/0 - Score: 3296
SGBRG10_CSI2P,1296x972/0 - Score: 1000
SGBRG10_CSI2P,1920x1080/0 - Score: 1349.67
SGBRG10_CSI2P,2592x1944/0 - Score: 1567
Stream configuration adjusted
[0:03:40.136923035] [2000] INFO Camera camera.cpp:1215 configuring streams: (0) 1296x972-YUV420/sYCC (1) 1296x972-SGBRG10_CSI2P/RAW
[0:03:40.137686108] [2004] INFO RPI vc4.cpp:620 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10/RAW - Selected unicam format: 1296x972-pGAA/RAW #10 (0.00 fps) exp 33239.00 ag 8.00 dg 1.00 #11 (30.01 fps) exp 33239.00 ag 8.00 dg 1.00 #12 (30.01 fps) exp 33239.00 ag 8.00 dg 1.00 #13 (30.01 fps) exp 33239.00 ag 8.00 dg 1.00 #14 (30.01 fps) exp 33239.00 ag 8.00 dg 1.00 #15 (30.01 fps) exp 33239.00 ag 8.00 dg 1.00 #16 (30.01 fps) exp 33239.00 ag 8.00 dg 1.00 #17 (30.01 fps) exp 33239.00 ag 8.00 dg 1.00 #18 (30.00 fps) exp 33239.00 ag 7.88 dg 1.00 #19 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #20 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #21 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #22 (29.99 fps) exp 33239.00 ag 7.88 dg 1.00 #23 (30.03 fps) exp 33239.00 ag 7.88 dg 1.00 #24 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #25 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #26 (29.99 fps) exp 33239.00 ag 7.88 dg 1.00 #27 (30.03 fps) exp 33239.00 ag 7.88 dg 1.00 #28 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #29 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #30 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #31 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #32 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #33 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #34 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #35 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #36 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #37 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #38 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #39 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #40 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #41 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #42 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #43 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #44 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #45 (30.00 fps) exp 33239.00 ag 7.88 dg 1.00 #46 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #47 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #48 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #49 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #50 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #51 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #52 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #53 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #54 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #55 (30.00 fps) exp 33239.00 ag 7.88 dg 1.00 #56 (30.02 fps) exp 33239.00 ag 7.88 dg 1.00 #57 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #58 (30.00 fps) exp 33239.00 ag 7.88 dg 1.00 #59 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #60 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #61 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #62 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #63 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #64 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #65 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #66 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #67 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #68 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #69 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #70 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #71 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #72 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #73 (30.00 fps) exp 33239.00 ag 7.88 dg 1.00 #74 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #75 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #76 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #77 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #78 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #79 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #80 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #81 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #82 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #83 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #84 (30.00 fps) exp 33239.00 ag 7.88 dg 1.00 #85 (30.02 fps) exp 33239.00 ag 7.88 dg 1.00 #86 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #87 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #88 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #89 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #90 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #91 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #92 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #93 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #94 (30.00 fps) exp 33239.00 ag 7.88 dg 1.00 #95 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #96 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #97 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #98 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #99 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #100 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #101 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #102 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #103 (30.00 fps) exp 33239.00 ag 7.88 dg 1.00 #104 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #105 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #106 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #107 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #108 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #109 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #110 (30.00 fps) exp 33239.00 ag 7.88 dg 1.00 #111 (30.02 fps) exp 33239.00 ag 7.88 dg 1.00 #112 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #113 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #114 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #115 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #116 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #117 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #118 (30.00 fps) exp 33239.00 ag 7.88 dg 1.00 #119 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #120 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #121 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #122 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #123 (30.00 fps) exp 33239.00 ag 7.88 dg 1.00 #124 (30.02 fps) exp 33239.00 ag 7.88 dg 1.00 #125 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #126 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #127 (30.01 fps) exp 33239.00 ag 7.88 dg 1.00 #128 (30.01 fps) exp 33239.00 ag 7.56 dg 1.01 #129 (30.01 fps) exp 33239.00 ag 7.19 dg 1.01 #130 (30.01 fps) exp 33239.00 ag 6.88 dg 1.00 #131 (30.01 fps) exp 33239.00 ag 6.75 dg 1.00 #132 (30.01 fps) exp 33239.00 ag 6.94 dg 1.00 #133 (30.01 fps) exp 33239.00 ag 7.31 dg 1.00 #134 (30.01 fps) exp 33239.00 ag 7.62 dg 1.00 #135 (30.01 fps) exp 33239.00 ag 7.62 dg 1.00 #136 (30.01 fps) exp 33239.00 ag 7.31 dg 1.00 #137 (30.01 fps) exp 33239.00 ag 7.00 dg 1.01 #138 (30.01 fps) exp 33239.00 ag 6.88 dg 1.00 #139 (30.01 fps) exp 33239.00 ag 7.00 dg 1.01 #140 (30.01 fps) exp 33239.00 ag 7.38 dg 1.01 #141 (30.01 fps) exp 33239.00 ag 7.62 dg 1.01 #142 (30.01 fps) exp 33239.00 ag 7.81 dg 1.00 #143 (30.01 fps) exp 33239.00 ag 7.69 dg 1.01 #144 (30.01 fps) exp 33239.00 ag 7.44 dg 1.00 #145 (30.01 fps) exp 33239.00 ag 7.25 dg 1.01 #146 (30.00 fps) exp 33239.00 ag 7.25 dg 1.01
This is the response when I run 7.computer_vision. What does it mean “Local display failed, because there is no gui?
bobshafer@Picar:~/picar-x/example $ sudo python3 7.computer_vision.py
vilib 0.3.18 launching …
picamera2 0.3.34
Local display failed, because there is no gui.
Web display on:
eth0: error fetching interface information: Device not found
Input key to call the function!
q: Take photo
1: Color detect : red
2: Color detect : orange
3: Color detect : yellow
4: Color detect : green
5: Color detect : blue
6: Color detect : purple
0: Switch off Color detect
r: Scan the QR code
f: Switch ON/OFF face detect
s: Display detected object information
How are you accessing the picar? ssh? From a PC? Mac? Linux machine?
Try
ssh -X
Instead to export the display
Or better use vnc
But, im not an expert in this exact area, i dont have a picarx, sunfounder will have certainly seen this exact issue before and give a better considered reply. Im only speculating best guesses. May be better to await their reply
It looks like your camera is already working properly. The 7.computer_vision.py script is mainly designed to allow users to preview the PiCar-X’s camera feed via a web browser, so the fact that you’re seeing the feed means your PiCar-X is functioning correctly.
The message about no display being detected appears because you are accessing the PiCar via SSH from a Windows 11 laptop, which doesn’t have a graphical desktop environment running.
To run scripts that require a display or to use the desktop interface, you can either:
Connect a physical monitor and keyboard directly to your PiCar-X.
Access the Raspberry Pi desktop remotely using VNC.