Frame Buffer using RPC

I was following the youtube video titled “How to use the OpenMV RPC Library to Transfer Images to your PC” and I came across an issue.

The only difference that I noticed when I was following along is that my available port is COM5 not COM7 as seen in the youtube video. When I run the script I get 0.0 for the frame buffer and a black screen as shown in the picture. I tried both scripts in the video hoping that maybe one would work but that was not the case. Any assistance would be helpful, thank you!

Wait, my apologies I was being dumb. I didn’t connect the camera to the OpenMV IDE but now I’m getting this error:

raise SerialException(“could not open port {!r}: {!r}”.format(self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port ‘COM5’: PermissionError(13, ‘Access is denied.’, None, 5)

Yeah, if the IDE is connected you cannot also connect to the camera for RPC.

It’s not really the easiest to use mechanism, so, you need to save the script to the camera saucy that it runs it automatically and then you can use the RPC library via the computer.

I was looking through some other posts and I saw that people came across this same issue. \

I saved the image_transfer_jpg_streaming_as_the_remote_device_for_your_computer.py to the camera and renamed it as main.py then went into a terminal navigated to my rpc directory, then ran python rpc_image_transfer_jpg_streaming_as_the_controller_device.py

After this I put the port that my computer is expecting and still get the black screen. Not sure what else I should try. I’ll look through more posts to see what worked for other folks.

I need to debug the code. It only sometimes works but isn’t as robust as the UART/I2C/SPI/CAN comms. It’s because the PC timeouts are all over the place and the protocol assumes you can send packets on-time.

If you pull up wireshark for USB you’ll probably see the PC pinging the camera and not getting an expected response in time and not connecting.

Unless you are obviously doing something wrong then it’s probably just the code is not good enough to handle this issue.

When I wrote this library… I think I have to change the protocol around slightly to fix this issue as the PC needs different behavior than what low level UART/I2C/SPI/CAN comms want.

Since I’m a new user it isn’t letting me upload files. Where can I send you the files that I’m working with? Also, I would like to mention that my main goal is to have the camera connected to a rover and powered through a raspberry pi. Once the camera is up and running, I would like to show people what the camera is capturing through my laptop. Would this even be possible through the RPC library or would I have to try something else?

Honestly, just use the IDE. You can VNC to the Pi and show the IDE running on it. However, this doesn’t get data off the camera. But, if you hook the OpenMV Cam to a UART on your Pi via some wires and the UART on the OpenMV cam then you can send serial data at up to 7.5Mb/s. Then you can just use the RPC library in UART mode. It works great for this.