Transferring images from OpenMV 7 to PC takes 1.3 seconds

General discussion about topics related to OpenMV.
amira.e
Posts: 6
Joined: Mon Jun 17, 2019 3:25 pm

Transferring images from OpenMV 7 to PC takes 1.3 seconds

Postby amira.e » Mon Jun 17, 2019 3:37 pm

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

Re: Transferring images from OpenMV 7 to PC takes 1.3 seconds

Postby iabdalkader » Mon Jun 17, 2019 4:03 pm

amira.e wrote:
Mon Jun 17, 2019 3:37 pm
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?
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:

Code: Select all

python2 pyopenmv_fb.py
amira.e
Posts: 6
Joined: Mon Jun 17, 2019 3:25 pm

Re: Transferring images from OpenMV 7 to PC takes 1.3 seconds

Postby amira.e » Mon Jun 17, 2019 4:11 pm

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

Re: Transferring images from OpenMV 7 to PC takes 1.3 seconds

Postby iabdalkader » Mon Jun 17, 2019 4:19 pm

Are you also using the IDE at the same time ? You shouldn't connect the IDE when using this script.
amira.e
Posts: 6
Joined: Mon Jun 17, 2019 3:25 pm

Re: Transferring images from OpenMV 7 to PC takes 1.3 seconds

Postby amira.e » Mon Jun 17, 2019 4:29 pm

No I reset the camera after using the IDE and left it disconnected from the IDE when trying this python code out.
User avatar
iabdalkader
Posts: 952
Joined: Sun May 24, 2015 3:53 pm

Re: Transferring images from OpenMV 7 to PC takes 1.3 seconds

Postby iabdalkader » Mon Jun 17, 2019 5:46 pm

I'll try to test it later tonight, what's your firmware version ? IDE version ? And Windows ?
User avatar
iabdalkader
Posts: 952
Joined: Sun May 24, 2015 3:53 pm

Re: Transferring images from OpenMV 7 to PC takes 1.3 seconds

Postby iabdalkader » Mon Jun 17, 2019 5:47 pm

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.
amira.e
Posts: 6
Joined: Mon Jun 17, 2019 3:25 pm

Re: Transferring images from OpenMV 7 to PC takes 1.3 seconds

Postby amira.e » Mon Jun 17, 2019 6:04 pm

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.
jimrooker
Posts: 1
Joined: Tue Jun 18, 2019 5:09 am

Re: Transferring images from OpenMV 7 to PC takes 1.3 seconds

Postby jimrooker » Tue Jun 18, 2019 5:11 am

I get the error message "struct.error: unpack requires a string argument of length 12"
basketball legends
User avatar
iabdalkader
Posts: 952
Joined: Sun May 24, 2015 3:53 pm

Re: Transferring images from OpenMV 7 to PC takes 1.3 seconds

Postby iabdalkader » Tue Jun 18, 2019 3:45 pm

Hi I tested both scripts with 3.4.1 on Windows 10, and they're both working fine:
Helloworld test:
Capture.PNG
Capture.PNG (4.42 KiB) Viewed 11061 times
And this is a framebuffer test:
Capture2.PNG

The only thing I can think of is there must be something in your main.py that's using USB VCP.
amira.e
Posts: 6
Joined: Mon Jun 17, 2019 3:25 pm

Re: Transferring images from OpenMV 7 to PC takes 1.3 seconds

Postby amira.e » Tue Jun 18, 2019 4:14 pm

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

Re: Transferring images from OpenMV 7 to PC takes 1.3 seconds

Postby iabdalkader » Tue Jun 18, 2019 5:51 pm

test.py just prints "Hello World!" and main.py is the default created with a fresh filesystem (blinks the blue LED).
amira.e
Posts: 6
Joined: Mon Jun 17, 2019 3:25 pm

Re: Transferring images from OpenMV 7 to PC takes 1.3 seconds

Postby amira.e » Wed Jun 19, 2019 6:43 pm

Hmm I still get the same error. Could it be something to do with the conda environment I'm using?
User avatar
iabdalkader
Posts: 952
Joined: Sun May 24, 2015 3:53 pm

Re: Transferring images from OpenMV 7 to PC takes 1.3 seconds

Postby iabdalkader » Wed Jun 19, 2019 11:01 pm

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.

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 7 guests