Saving video and timestamps

I am trying to save a video, and also save its corresponding timestamps from openMV to my computer. How exactly would I do that? I know I can save a video with the frame buffer, but that does not have timestamps. I could record the timestamps and save them along with the video onto an SD card, but i don’t want to save it onto an SD card and then have to transfer it onto the computer. Is there a way to save the video and timestamps from OpenMV to my computer?

Hi, you can use the draw_string method to draw the time stamp on the frame buffer. For he next release we upgraded the method to allow for font scaling but for the current firmware it’s pretty basic. Um, anyway, give the draw_string() method a try.

Thanks, but this doesn’t allow me to access the timestamps for further processing… I would now have to do some OCR or something to access it? Is there not a better way?

Hi, you can print data to the serial port… note that you can print both the jpeg compressed image and text to the serial port. Um, do you need a pointer on this?

Simple:

print(img.snapshot().compress())

Will print image data… That said, it’s in binary and will mess up any terminal program that receives it. We also support:

print(img.snapshot().compress_for_ide())

Which manipulates the data before sending it to avoid text overlap. If you need the code to them convert the data back into a regular jpeg byte stream I can provide it in C.

Is it possible to convert it back to video stream using python. Unfortunately, I do not use C. I have never used serial before (except with an Arduino I think).

Yes, we have a control script for the OpenMV Cam that you can use. Please see our github/openmv/usr/OpenMV.py script.

What is the usage of this script? Also, is it possible to save a video using this script? Is it possible for the data to be processed by another program, like an OpenCV program?

The script uses numpy to store an iamge in a numpy array. It’s really not anything other than a starting point for talking to the camea. Given the questions you are asking I’m guessing you like something more turn key.

Unfortunately, I don’t have the ability to offer any more than than being able to pull images into a numpy array for python right now.

Ok, but still, what is the usage of the script?

Hi, please see the python code here:

https://github.com/openmv/openmv/blob/master/usr/openmv.py

I know, but I ask because the code wasn’t very well commented/documented. So like what’s the output? It prints some

tx_buf(tx_len)

but what is that? And the input is the OpenMV script?

It’s basically sending a command to the camera to execute a python script.

x_len = tx_buf_len()
    if (tx_len):
        print(tx_buf(tx_len))

Then prints the result of the script if there was an error. Otherwise the script that you sent to the camera will run and the one of the PC will exit. If you’d like to then grab image data and text output you must add a loop of doing:

x_len = tx_buf_len()
    if (tx_len):
        print(tx_buf(tx_len))

And also:

fb_dump()