Issue of Pi camera

I’m doing the picar-x project now, and other things are working well. However, I’m stuck at enabling camera on my pi 4 (Raspberry Pi 4 Model B Rev 1.5)

$ vcgencmd get_camera
supported=0 detected=0, libcamera interfaces=0

~ $ libcamera-hello
[0:03:45.808735576] [3014] INFO Camera camera_manager.cpp:327 libcamera v0.4.0+53-29156679
[0:03:45.859006614] [3023] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:03:45.861529761] [3023] INFO RPI vc4.cpp:447 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media3 and ISP device /dev/media0
[0:03:45.861641951] [3023] INFO RPI pipeline_base.cpp:1121 Using configuration file ‘/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml’
Made X/EGL preview window
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:46.345014940] [3014] INFO Camera camera.cpp:1202 configuring streams: (0) 1296x972-YUV420 (1) 1296x972-SGBRG10_CSI2P
[0:03:46.346184723] [3023] INFO RPI vc4.cpp:622 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10 - Selected unicam format: 1296x972-pGAA
[0:03:47.477688856] [3023] WARN V4L2 v4l2_videodevice.cpp:2150 /dev/video0[13:cap]: Dequeue timer of 1000000.00us has expired!
[0:03:47.477871233] [3023] ERROR RPI pipeline_base.cpp:1367 Camera frontend has timed out!
[0:03:47.477887548] [3023] ERROR RPI pipeline_base.cpp:1368 Please check that your camera sensor connector is attached securely.
[0:03:47.477904901] [3023] ERROR RPI pipeline_base.cpp:1369 Alternatively, try another cable and/or sensor.
ERROR: Device timeout detected, attempting a restart!!!
^C

:~/picar-x/example $ sudo python3 9.record_video.py
vilib 0.3.15 launching …
picamera2 0.3.25
Imgshow start …

Web display on:
http://192.168.45.67:9000/mjpg

Starting web streaming …

  • Serving Flask app ‘vilib.vilib’
  • Debug mode: off

Press keys on keyboard to control recording:
Q: record/pause/continue
E: stop
Ctrl + C: Quit

[0:04:42.218064544] [3265] ERROR RPI pipeline_base.cpp:1367 Camera frontend has timed out!
[0:04:42.218218040] [3265] ERROR RPI pipeline_base.cpp:1368 Please check that your camera sensor connector is attached securely.
[0:04:42.218259182] [3265] ERROR RPI pipeline_base.cpp:1369 Alternatively, try another cable and/or sensor.
Error on request:
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/werkzeug/serving.py”, line 335, in run_wsgi
execute(self.server.app)
File “/usr/lib/python3/dist-packages/werkzeug/serving.py”, line 324, in execute
for data in application_iter:
File “/usr/lib/python3/dist-packages/werkzeug/wsgi.py”, line 500, in next
return self._next()
^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/werkzeug/wrappers/response.py”, line 50, in _iter_encoded
for item in iterable:
File “/usr/local/lib/python3.11/dist-packages/vilib/vilib.py”, line 88, in gen
frame = get_frame()
^^^^^^^^^^^
File “/usr/local/lib/python3.11/dist-packages/vilib/vilib.py”, line 70, in get_frame
return cv2.imencode(‘.jpg’, Vilib.flask_img)[1].tobytes()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cv2.error: OpenCV(4.11.0) :-1: error: (-5:Bad argument) in function ‘imencode’

Overload resolution failed:

  • img is not a numpy array, neither a scalar
  • Expected Ptrcv::UMat for argument ‘img’
    Traceback (most recent call last):
    File “/home/tqcs/picar-x/example/9.record_video.py”, line 68, in
    main()
    File “/home/tqcs/picar-x/example/9.record_video.py”, line 31, in main
    key = readchar.readkey()
    ^^^^^^^^^^^^^^^^^^
    File “/usr/local/lib/python3.11/dist-packages/readchar/_posix_read.py”, line 37, in readkey
  1. Please confirm whether the camera is wired correctly and whether the resolution is firm.
    It is recommended to reconnect according to the pictures we provided. Also replace the FFC cable to see the working results.
  2. What version of the system are you currently using? Please tell us.
  3. Execute the libcamera-hello command to check whether the camera is detected. Please provide print information.




Raspberry Pi 4 Model B Rev 1.5

Linux raspberrypi 6.6.74+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.74-1+rpt1 (2025-01-27) aarch64 GNU/Linux

tqcs@raspberrypi:~ $ vcgencmd get_camera
supported=0 detected=0, libcamera interfaces=0
tqcs@raspberrypi:~ $ libcamera-hello
[0:00:58.823728370] [2587] INFO Camera camera_manager.cpp:327 libcamera v0.4.0+53-29156679
[0:00:58.870382741] [2596] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:00:58.873054648] [2596] INFO RPI vc4.cpp:447 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media1 and ISP device /dev/media0
[0:00:58.873135407] [2596] INFO RPI pipeline_base.cpp:1121 Using configuration file ‘/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml’
Made X/EGL preview window
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:00:59.410985296] [2587] INFO Camera camera.cpp:1202 configuring streams: (0) 1296x972-YUV420 (1) 1296x972-SGBRG10_CSI2P
[0:00:59.411345277] [2596] INFO RPI vc4.cpp:622 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10 - Selected unicam format: 1296x972-pGAA
[0:01:00.535705573] [2596] WARN V4L2 v4l2_videodevice.cpp:2150 /dev/video0[13:cap]: Dequeue timer of 1000000.00us has expired!
[0:01:00.535794091] [2596] ERROR RPI pipeline_base.cpp:1367 Camera frontend has timed out!
[0:01:00.535808091] [2596] ERROR RPI pipeline_base.cpp:1368 Please check that your camera sensor connector is attached securely.
[0:01:00.535823925] [2596] ERROR RPI pipeline_base.cpp:1369 Alternatively, try another cable and/or sensor.
ERROR: Device timeout detected, attempting a restart!!!

when I command libcamera-hello, this blank/dark window pops up

I purchased another camera module online, and it works. I think there’s an issue in the provided camera

we will send you a camera module, please contact service@sunfounder.com