Transferring images from OpenMV 7 to PC takes 1.3 seconds

Hi guys,

I’ve read many threads about this but still haven’t been able to figure it out. I am trying to transfer image frames from my camera to my PC (Windows 10) using python, ideally at a rate of ~10 frames per second. Following the example ‘usb_vcp.py’ I am able to transfer image frames and view them from my computer, but it takes ~1.3 seconds per frame just to transfer.

I also tried running the ‘pyopenmv_fb.py’ / ‘pyopenmv.py’ examples from github but got an error because nothing was transferred (empty buffer). I was using the upython script included at the beginning of ‘pyopenmv_fb.py’ but I noticed that it has no print or usb.send command so I’m not sure how the image would be transferred?

Thanks!

pyopenmv_fb.py uses the debugging mode to execute a script that updates the fb (the example script at the beginning of the file) and then it reads the framebuffer directly. For this to work you just need to connect the camera and run pyopenmv_fb.py on PC, like so:

python2 pyopenmv_fb.py

Thanks. If I do this, I get an error “struct.error: unpack requires a string argument of length 12”. I tried printing __serial.read(12) from the fb_size() function and it was blank (nothing).

Are you also using the IDE at the same time ? You shouldn’t connect the IDE when using this script.

No I reset the camera after using the IDE and left it disconnected from the IDE when trying this python code out.

I’ll try to test it later tonight, what’s your firmware version ? IDE version ? And Windows ?

Also please make sure you don’t have any scripts running that use VCP. Like if main.py uses VCP it will break the script.

Thanks! I don’t have any scripts running with VCP.
My firmware version is 3.4.1, IDE version is 2.2.0, and I’m using Windows 10 Pro.

I get the error message “struct.error: unpack requires a string argument of length 12”
basketball legends

Hi I tested both scripts with 3.4.1 on Windows 10, and they’re both working fine:
Helloworld test:
Capture.PNG
And this is a framebuffer test:


The only thing I can think of is there must be something in your main.py that’s using USB VCP.

Thanks for testing it. Just to make sure I’m doing the exact same thing, could you share what your test.py is and your main.py on the camera?

test.py just prints “Hello World!” and main.py is the default created with a fresh filesystem (blinks the blue LED).

Hmm I still get the same error. Could it be something to do with the conda environment I’m using?

Maybe, I used Python 2.7 and pip to install pyserial, pygame etc… you should try that in a Windows VM and see if it works.