how use python code read video, not use openide

General discussion about topics related to OpenMV.
dotzhang
Posts: 2
Joined: Wed Nov 06, 2019 5:38 am

how use python code read video, not use openide

Postby dotzhang » Wed Nov 06, 2019 5:43 am

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.
User avatar
iabdalkader
Posts: 1002
Joined: Sun May 24, 2015 3:53 pm

Re: how use python code read video, not use openide

Postby iabdalkader » Wed Nov 06, 2019 10:58 am

Yes you can use the UVC firmware. Just keep in mind OpenMV is not meant to be used as a webcam.
dotzhang
Posts: 2
Joined: Wed Nov 06, 2019 5:38 am

Re: how use python code read video, not use openide

Postby dotzhang » Sat Nov 09, 2019 7:57 pm

iabdalkader wrote:
Wed Nov 06, 2019 10:58 am
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.
User avatar
iabdalkader
Posts: 1002
Joined: Sun May 24, 2015 3:53 pm

Re: how use python code read video, not use openide

Postby iabdalkader » Mon Nov 11, 2019 6:22 pm

dotzhang wrote:
Sat Nov 09, 2019 7:57 pm
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.
User avatar
kwagyeman
Posts: 3448
Joined: Sun May 24, 2015 2:10 pm

Re: how use python code read video, not use openide

Postby kwagyeman » Mon Nov 11, 2019 6:26 pm

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

The UVC firmware is under <openmv-ide-install-dir>/share/qtcreator/firmware/OPENMV4/uvc.bin

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

Return to “General Topics”

Who is online

Users browsing this forum: MSN [Bot] and 6 guests