I want to access both cameras as webcam camera feeds using OpenCV. Is that possible? Do I need to separately run teo rgb_uvc.py or can I access it both together?
Can we use two Oak D Lite cameras as webcam?
Hi, thank you! I generally wanted to access video stream from two cameras. Is there any other option to access it without the uvc node? I just want the raw video footage thats it
SadiaC
UVC node makes it so the host recognizes the device as a USB webcam. The only other option you have is standard frame streaming method using xlink. But as you wish to use the device as webcam, there is no other way of doing it (maybe rtsp streaming or something similar could work).
Thanks,
Jaka
- Edited
Hi is there any other way i would be able to access both the cameras? How about by using xlink to access both the camera? Or can i do one each? One with uvc node and another with xlink node?
Hi SadiaC
Streaming with Xlink node is the standard way of accessing frames/messages from the device. You can create as many streams as you wish as long as there is bandwidth available on your usb cable.
But it won't function as a webcam.
EDIT: Just re-reading through, we are talking about two cameras on a single Oak-D-lite, not one camera on two OAK-D-lite devices right?
Thanks,
Jaka
- Edited
Hi, thank you for your reply. Sorry I wasn't clear, I am using a Jetson Nano as a host and I want to access videos from two different Oak D lite cameras. Since I only want the video footage and not the depth or detection stuff, I thought the approach should be to access the two cameras as webcams. But now that you mention it, I can use Xlink nodes instead, right?
Hi SadiaC
Yes, you can use Xlink nodes, it should be more reliable anyway. You can connect to both from the same script, see https://docs.luxonis.com/projects/api/en/latest/tutorials/multiple/.
Thanks,
Jaka
Thank you! I have tried using XLink and following the instructions that you sent. I only get one camera to be recognized and the other one gives this error
with dai.Device(pipeline, device_info) as device:
RuntimeError: Device already closed or disconnected: io error
Yes, I am using the latest depthai. I have depthai-2.23.0.0. I tried the script again, I got these errors:
[ WARN:2@5.574] global D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (464) `anonymous-namespace'::SourceReaderCB:nReadSample videoio(MSMF): OnReadSample() is called with error status: -2147024809
[ WARN:2@5.577] global D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (476) `anonymous-namespace'::SourceReaderCB:nReadSample videoio(MSMF): async ReadSample() call is failed with error status: -2147024809
[ WARN:1@5.580] global D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (1752) CvCapture_MSMF::grabFrame videoio(MSMF): can't grab frame. Error: -2147024809
Error: Could not read frame.
I have now changed the usb cables, it now works if I try to open it separately but when running the script that you sent for multiple devices, ( luxonis/depthai-experiments/blob/master/gen2-multiple-devices/main.py), I get the following errors. It does recognise two devices but only shows one of them:
Found 2 devices
C:\Users\sadia\depthai-python\depthai-python\examples\ColorCamera\MultiCamera.py:31: DeprecationWarning: Use constructor taking 'UsbSpeed' instead
device: dai.Device = stack.enter_context(dai.Device(openvino_version, dev_info, False))
=== Connected to 1844301021AD0E1300
MXID: 1844301021AD0E1300
Cameras: CAM_A CAM_B CAM_C
USB speed: SUPER
C:\Users\sadia\depthai-python\depthai-python\examples\ColorCamera\MultiCamera.py:19: DeprecationWarning: RGB is deprecated, use CAM_A or address camera by name instead.
cam_rgb.setBoardSocket(dai.CameraBoardSocket.RGB)
Exception in thread Thread-2:
Traceback (most recent call last):
File "C:\Users\sadia\anaconda3\envs\v7\lib\threading.py", line 980, in _bootstrap_inner
self.run()
File "C:\Users\sadia\anaconda3\envs\v7\lib\threading.py", line 917, in run
self._target(\*self._args, \*\*self._kwargs)
File "C:\Users\sadia\depthai-python\depthai-python\examples\ColorCamera\MultiCamera.py", line 31, in worker
device: dai.Device = stack.enter_context(dai.Device(openvino_version, dev_info, False))
RuntimeError: Device already closed or disconnected: io error