Open a video file from computer with OpenMV IDE

Discussion related to "under the hood" OpenMV topics.
Hydrorion
Posts: 7
Joined: Mon May 28, 2018 5:39 am

Open a video file from computer with OpenMV IDE

Postby Hydrorion » Fri Jun 08, 2018 9:07 am

Hello everyone !
It's my first time with machine vision and i wanted to start with OpenMV M7 !
In order to ease test and developpement of my project i would like to read a video file from my computer instead of the camera video, any idea ?
(PS : I tryed to import cv2 but it didn't work)
User avatar
kwagyeman
Posts: 2032
Joined: Sun May 24, 2015 2:10 pm

Re: Open a video file from computer with OpenMV IDE

Postby kwagyeman » Fri Jun 08, 2018 12:35 pm

The OpenMV Cam cannot read video files from the PC. The system is a microcontroller running MicroPython. While you can program it in Python you don't have access to desktop python libraries. MicroPython is there to make it do whatever you need easy via a scripting language interface.

Anyway, what is your application? I'll try to guide you on what you need to do.
Nyamekye,
Hydrorion
Posts: 7
Joined: Mon May 28, 2018 5:39 am

Re: Open a video file from computer with OpenMV IDE

Postby Hydrorion » Sun Jun 10, 2018 8:47 am

Well i'm trying to pilote an adaptative driving beam depending on what is in front of a care. Since it's a bit hard to develop and driving by night i would like to test the code on a video. I know we can play back a video we already saved, but i wanted to try on another video i get from internet before. Maybe i can put the video on the on micro sd card and play it ? I didn't find a way to play a video witch is on sd card, is it possible ?
User avatar
kwagyeman
Posts: 2032
Joined: Sun May 24, 2015 2:10 pm

Re: Open a video file from computer with OpenMV IDE

Postby kwagyeman » Sun Jun 10, 2018 12:44 pm

I see, to do this you'll need me to create a converter in OpenMV IDE that allows you to turn a video into one of the RAW video capture files the OpenMV Cam can read. I have a converter for turning that into a normal video file but not the other way around.

This is a good feature request. Can you make a ticket for tracking this here and I'll do it: https://github.com/openmv/openmv-ide/issues
Nyamekye,
Hydrorion
Posts: 7
Joined: Mon May 28, 2018 5:39 am

Re: Open a video file from computer with OpenMV IDE

Postby Hydrorion » Sun Jun 10, 2018 1:43 pm

No problemes !
Thank for your quick answer.

I wanted to thank you for your work to, that's really a good project, you guys are doing a great job ! I wish the best for you guys.
Hydrorion
Posts: 7
Joined: Mon May 28, 2018 5:39 am

Re: Open a video file from computer with OpenMV IDE

Postby Hydrorion » Wed Jul 11, 2018 5:08 am

Hello !
Thank you very much for the last update, as soon as i saw the video converter i tested it !

But i may have some trouble with the converter : my .wmv video use 14,5 Mo memory space while the .bin video converted using 2,5 Go !

Is this normal ?
User avatar
kwagyeman
Posts: 2032
Joined: Sun May 24, 2015 2:10 pm

Re: Open a video file from computer with OpenMV IDE

Postby kwagyeman » Wed Jul 11, 2018 12:04 pm

Hi, the converter works by using FFMPEG to break the file up into a bunch of image stills and then I build up an OpenMV Cam video .bin file out of those stills. All timing information is stripped. So, the video will run very fast on the OpenMV Cam if you aren't doing any processing.
Nyamekye,
Hydrorion
Posts: 7
Joined: Mon May 28, 2018 5:39 am

Re: Open a video file from computer with OpenMV IDE

Postby Hydrorion » Thu Jul 12, 2018 4:34 am

Still, i didn't get why the size of the video explode like this :/
Moreover i have an FB Overflow error when i launch the exemple code "image_reader_1.py", i think my video resolution is to high for the hardware ?
Is the converter working better depending of witch kind of source file (mp4, wmv, etc) the video is ?


Edit : Changing the resolution to 160 width (qqvga) solve the "OSerror : FBOverflow". I did it easily on a website. Maybe it is possible to adapt the video resolution with the converter you create on OpenMV IDE ? It will be awesome !
User avatar
kwagyeman
Posts: 2032
Joined: Sun May 24, 2015 2:10 pm

Re: Open a video file from computer with OpenMV IDE

Postby kwagyeman » Thu Jul 12, 2018 3:37 pm

Ah, yeah, the res of the video is limited on the camera. Um, make a github issue on the IDE to support resolution changes with FFMPEG.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 7 guests