Hi,
Recently, I faced a problem below:
Set up
print(Picamera2.global_camera_info()) produces
[{'Model': 'ov5647', 'Location': 2, 'Rotation': 0, 'Id': '/base/soc/i2c0mux/i2c@1/pca@70/i2c@0/ov5647@36'}, {'Model': 'ov5647', 'Location': 2, 'Rotation': 0, 'Id': '/base/soc/i2c0mux/i2c@1/pca@70/i2c@1/ov5647@36'}]
The issue comes in using Picamera2 to switch between these cameras. Calling stop() on one camera and then calling start() on the other results in a device busy error. If I call close() then I can successfully start the other camera, but close() completely deallocates the camera object and closing and re-creating camera objects is computationally expensive and slow.
Below is a sample code that shows the problem.ERROR V4L2 v4l2_videodevice.cpp:1047 /dev/video0[26:cap]: Unable to set format: Device or resource busyIs this Multiplexer not compatible with Picamera2? Hopefully, you shed light on this problem.
Thank you in advance
BTW, ask if you need more information from me.
Recently, I faced a problem below:
Set up
- RaspberryPi 4B 8 GB
- Bullseye OS 64 bi, kernel version:6.1.21
- Arducam Multi Camera Adapter v2.2 with 2 OV5647 cameras attached in ports A and C
print(Picamera2.global_camera_info()) produces
[{'Model': 'ov5647', 'Location': 2, 'Rotation': 0, 'Id': '/base/soc/i2c0mux/i2c@1/pca@70/i2c@0/ov5647@36'}, {'Model': 'ov5647', 'Location': 2, 'Rotation': 0, 'Id': '/base/soc/i2c0mux/i2c@1/pca@70/i2c@1/ov5647@36'}]
The issue comes in using Picamera2 to switch between these cameras. Calling stop() on one camera and then calling start() on the other results in a device busy error. If I call close() then I can successfully start the other camera, but close() completely deallocates the camera object and closing and re-creating camera objects is computationally expensive and slow.
Below is a sample code that shows the problem.
Code:
from picamera2 import Picamera2import timecam0 = Picamera2(0)cam1 = Picamera2(1)cam0.start()cam0.capture_file("cam0.jpg")cam0.stop() #code succeeds if this is cam0.close()time.sleep(5)cam1.start()cam1.capture_file("cam1.jpg")cam1.stop()
Code:
Traceback (most recent call last): File "/home/me/tests/test.py", line 15, in <module> cam1.start() File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 1049, in start self.configure(config) File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 1004, in configure self.configure_(camera_config) File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 943, in configure_ if self.camera.configure(libcamera_config):RuntimeError: Failed to configure camera: Device or resource busy
Thank you in advance

BTW, ask if you need more information from me.
Statistics: Posted by DaPiLad — Fri Apr 12, 2024 2:43 am — Replies 0 — Views 39