how use python code read video, not use openide

I try use python opencv read video, but fail, i only read mac camera, not read openmv video.
python code:

import cv2

i try parameters use 0,1,2,3,4,5, but only 0 is available

video = cv2.VideoCapture(0)
test = video.isOpened()

cv2.VideoCapture(0) output true, this is mac computer camera

cv2.VideoCapture(1) output false

cv2.VideoCapture(2) output false

print(test)

In OPENMV IDE, the camera is success, now i want use python read video, then show web pages. can this be done? What are some ways to use python read video? thanks.

Yes you can use the UVC firmware. Just keep in mind OpenMV is not meant to be used as a webcam.

If use the UVC firmware, this need modify openmv sourcecode ? Now, i already try use python uvc fireware read video, but always not find the camera, I was used cv2 read.
can you have through uvc read video example python code? thanks you very much.

The UVC firmware is included in the IDE firmware folder, you just need to upload that instead and you don’t need to modify source code. The camera will work like a webcam, you can use cv2 to read it. Note if you upload the UVC firmware the camera will no longer work with the IDE and it will not run Python it will just look like a webcam.

A note, the bootloader will still be on the camera so you can still easily restore the normal firmware.

The UVC firmware is under /share/qtcreator/firmware/OPENMV4/uvc.bin

Use the Tools->Run bootloader dialog to reflash the camera.

There seems to be an issue with UVC firmware and macOS I can not get it to connect to camera in opencv. I have confirmed OPENMV4 is working as UVC device as it shows up in system profiler under cameras as

OpenMV Virtual Comm Port in FS Mode #2:

Model ID: UVC Camera VendorID_4617 ProductID_43985
Unique ID: 0x141300001209abd1


Also lsusb
Bus 020 Device 005: ID 1209:abd1 1209 OpenMV UVC in FS Mode Serial: 000000000011

I tried various programs to see if it is working as webcam such as Quick Time Player, Photo Booth and Plugable digital view. While all show the camera as an options none can connect to it.

I am using the Lepton 3 sensor which works fine with the normal firmware. I am currently using pyopenmv.py and normal firmware to get around this issue but it would be good to get UVC options working.

Hi, this is an Ibrahim question. Note that the UVC firmware isn’t really that supported. We did it because a customer thought it would be a cool idea. However, UVC doesn’t have a JPEG stream option so it’s hard to send lots of data over USB with it.

Some programs show two UVC devices you have to try each one. Note this hasn’t been tested on MacOS it’s only known to work on Linux with guvcview.