I am working on a project and the idea is streaming video from OpenMV to NodeMCU in order to show them in a webserver or something similar.
I did manage to establish the UART connection between OpenMv and NodeMCU to transfer the size of image, but I didn’t find any arduino library for reading and decoding image data.
Any sample code, library or comment is highly appreciated.
Hi, the image can be jpeg compressed on the OpenMV Cam and then you can send a the length of the image along with the image data to the device.
Most Microcontrollers can’t actually buffer in ram raw image sizes since they are huge. Is there a reason you need to send raw image data?
Thanks for the response.
Actually my ultimate goal is to make a wireless camera!.So I am trying to send the images by a high FPS rate to NodeMcu and reconstruct the image in NodeMcu and plot it in a web server.
Not sure if the way I am going to make a wireless camera is the best possible solution or not, so any idea in this manner is highly appreciated.
It is notable, so far I did manage to send the images bytes and read them in the NodeMcu, but still not sure how should I reconstruct it again as I do not know the order of received bytes.
For instance in the OpenMv IDE the size of image is printed 1250 and I get these 1250 bytes in the controller properly, but I do not know how to concatenate them together.
Just do like:
jpg = img.compress() UART.write(struct.pack("<I", len(jpg))) UART.write(jpg)
This will send the length and then the jpg image bytes. Any PC that can read a jpg image byte stream can view the jpg image. So, you can setup some code to stream mjpeg images with nodemcu and then you just send the raw byte streams you receive above.
Thanks for the response.
I am wondering is there any arduino library to decode received bytes ? Does OpenMV has any Arduino library to get connected to it?
I understand that, the image is coded in RGB565 format, but I still do not know how to decode and reconstruct received bytes in the controller.
Hi, we don’t really provide Arduino libraries since the camera ins’t a fixed function sensor. It’s another microcontroller so you can literally make it talk to your Arduino in whatever way you’d like.
As for the image data. What Arduino are you plugging the OpenMV Cam into? A standard AVR Arduino is unlikely to be able to keep up. Images are usually lager than all the SRAM on an Arduino Uno or Mega.
Anyway, given you application, I recommend you just accept a JPG image as sent by the code above for the OpenMV Cam. JPG images are not RGB565, but, they can be decoded easily by a lot of desktop software.
If you are trying to do image manipulation on the Arduino I recommend that you do that on the OpenMV Cam and then just send the final result to the Arduino which it just passes without modification through Node MCU.