Streaming videos from OpenMV to nodeMCU

Discussion related to "under the hood" OpenMV topics.
Kahroba
Posts: 9
Joined: Fri Dec 27, 2019 1:30 pm

Streaming videos from OpenMV to nodeMCU

Postby Kahroba » Fri Dec 27, 2019 1:42 pm

Hello,
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.
User avatar
kwagyeman
Posts: 4269
Joined: Sun May 24, 2015 2:10 pm

Re: Streaming videos from OpenMV to nodeMCU

Postby kwagyeman » Fri Dec 27, 2019 4:27 pm

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?
Nyamekye,
Kahroba
Posts: 9
Joined: Fri Dec 27, 2019 1:30 pm

Re: Streaming videos from OpenMV to nodeMCU

Postby Kahroba » Fri Dec 27, 2019 5:23 pm

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.
User avatar
kwagyeman
Posts: 4269
Joined: Sun May 24, 2015 2:10 pm

Re: Streaming videos from OpenMV to nodeMCU

Postby kwagyeman » Fri Dec 27, 2019 9:35 pm

Just do like:

Code: Select all

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.
Nyamekye,
Kahroba
Posts: 9
Joined: Fri Dec 27, 2019 1:30 pm

Re: Streaming videos from OpenMV to nodeMCU

Postby Kahroba » Sat Dec 28, 2019 7:56 am

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.
User avatar
kwagyeman
Posts: 4269
Joined: Sun May 24, 2015 2:10 pm

Re: Streaming videos from OpenMV to nodeMCU

Postby kwagyeman » Sat Dec 28, 2019 6:19 pm

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.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 10 guests