Page 1 of 1

Open a video file from computer with OpenMV IDE

Posted: Fri Jun 08, 2018 9:07 am
by Hydrorion
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)

Re: Open a video file from computer with OpenMV IDE

Posted: Fri Jun 08, 2018 12:35 pm
by kwagyeman
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.

Re: Open a video file from computer with OpenMV IDE

Posted: Sun Jun 10, 2018 8:47 am
by Hydrorion
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 ?

Re: Open a video file from computer with OpenMV IDE

Posted: Sun Jun 10, 2018 12:44 pm
by kwagyeman
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

Re: Open a video file from computer with OpenMV IDE

Posted: Sun Jun 10, 2018 1:43 pm
by Hydrorion
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.

Re: Open a video file from computer with OpenMV IDE

Posted: Wed Jul 11, 2018 5:08 am
by Hydrorion
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 ?

Re: Open a video file from computer with OpenMV IDE

Posted: Wed Jul 11, 2018 12:04 pm
by kwagyeman
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.

Re: Open a video file from computer with OpenMV IDE

Posted: Thu Jul 12, 2018 4:34 am
by Hydrorion
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 !

Re: Open a video file from computer with OpenMV IDE

Posted: Thu Jul 12, 2018 3:37 pm
by kwagyeman
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.