Transfering images from the usb OpenMV camera to the computer using PyCharm IDE

Dear all,

We are using your camera for pattern matching and visualization,

I am trying to transfer images from the usb to the computer using this program open in PyCharm :

The following program has been loaded on the microcontroller camera : “image_transfer_jpg_as_the_remote_device_for_your_computer.py” on the OpenMV Cam

When trying to execute the program on PyCharm, i have the following error, I don’t know what I can do,

Would you have an idea ?

Thank you very much,

Best regards,

Wil.


Traceback (most recent call last):
File “C:/Users/Perso/WIL/14 - PROJECT21/PROJECT0/Image_processing/OpenMV_camera.py”, line 7, in
import io, pygame, rpc, serial, serial.tools.list_ports, socket, struct, sys
File “C:\Users\Perso\WILFRID\05 - TECHNICAL\Arduino_Python\Real_time2\venv\lib\site-packages\rpc_init_.py”, line 6, in
from rpc import jsonrpc, thrifty
File “C:\Users\Perso\WIL\05 - TECHNICAL\Arduino_Python\Real_time2\venv\lib\site-packages\rpc\jsonrpc.py”, line 12, in
from rpc import exceptions, clients, servers, chains
File “C:\Users\Perso\WIL\05 - TECHNICAL\Arduino_Python\Real_time2\venv\lib\site-packages\rpc\servers.py”, line 126
print ‘closes!’
^
SyntaxError: Missing parentheses in call to ‘print’. Did you mean print(‘closes!’)?


I think it’s importing some other RPC library.

Thank you for your answer : i ever installed the rpc package through “pip install rpc command”… :wink: what kind of rpc library you think we could add ?

Hello Kwagyema,
Thank you for your answer,
Now using your recommendations, I have the following sytnax error :


line 29, in
interface = rpc.rpc_usb_vcp_master(port=input())
AttributeError: module ‘rpc’ has no attribute ‘rpc_usb_vcp_master’


Thank you for your help !

Are you actually including the right rpc library?

If you are going to attach to the camera via python from the PC it’s expected you know what you are doing.

Are you actually including the right rpc library? → i have installed a package called rpc but seems not to be the good one,
Sorry but could you indicate me how can i install the rpc library for the OpenMV camera?
Thank you for your answer.

The camera has the rpc library on it. On the PC you just need the rpc.py file linked to above…

I pointed you to a desktop version of the library. You just put it into the same folder as the script you are writing for your desktop device.

Hello Kwagyeman,

Thank you for your precisions,

I refer to this following topic, since I have the same results of black window.

I have tested the 2 remote control configurations giving the same results :

  • jpg image transfer
  • streaming jpg image transfer

Let me know if you need more details on my configuration,

Thank you very much for your help !

It seems I have to debug this code some more, I’ll see if I can fix it.

Hello Kwagyeman,
That is very kind of you, thank you very much !
I look forward to hearing from you :wink:

Dear Kwagyeman,

Would you have any solution to the current issue ?

Thank you for your answer,

Best regards,

Sorry, I haven’t gotten to it yet.

Dear Kwagyeman,

Any news on this topic ? in a first approach, I just want to collect images (not necessary to have a video flux) of the OpenMV camera on my PC for post processing,

Thank you very much for your efforts, see you !

I’m way to backed up.

However, there’s another way to do this…

So, you can just print() the jpeg image. It’s a byte array.

E.g.

img = img.compress()
print(len)
print(img.bytearray()) 

Then on the desktop you can just look for the length bit.

However, this is hard to sync up with.

If you are willing to write some code then a much better method is to use the jpeg compressed for IDE tooling:

print(img.compressed_for_ide()) 

This will emit a jpeg image that has been formatted in a way where you can pick it out of a serial stream.

Here’s the code how to decode it:

Note all is needed from the above method. But, it’s like a shift register for the bytes coming in. You can do something similar in python.