Convert Image To Pixel Array

Discussion related to "under the hood" OpenMV topics.
varun847
Posts: 2
Joined: Sun Jun 23, 2019 3:56 pm

Convert Image To Pixel Array

Postby varun847 » Sun Jun 23, 2019 4:10 pm

Hi Team,
I am working on a project which involves OpemMv M7 and NodeMCU. I Would like to capture image using OpenMv and Store It to Nodemcu SpiFFs memory using UART, So far I am Able To communicate with openmv and nodemcu using UART also when I try to send image to nodemcu using RXD And TXD Pins I am able to send some strange alphanumeric codes from openmv to nodemcu. Now what I want to do is to convert the image to array list and then send the values to nodemcu for storage so that I can upload it to web and then convert the array to image again but I am not able to convert the image to array using any function as I am not sure if there exist any function which can convert image to string array in micropython openmv library. Please Help me if someone can suggest how to do it.
User avatar
kwagyeman
Posts: 3837
Joined: Sun May 24, 2015 2:10 pm

Re: Convert Image To Pixel Array

Postby kwagyeman » Sun Jun 23, 2019 6:21 pm

You have to get a pixel at a time using the get pixel method and send that as ASCII. It's going to be extremely slow. The hex data you sent before is the raw binary image.

Um, images are treated as linear int arrays BTW. You can just index them with [] in python to get values. However, I recommend using get_pixel() for the image if it's non compressed. If it's compressed use [] and the size of the byte array is image.size().
Nyamekye,
varun847
Posts: 2
Joined: Sun Jun 23, 2019 3:56 pm

Re: Convert Image To Pixel Array

Postby varun847 » Wed Jul 10, 2019 4:40 pm

Hey kwagyeman,
I Was Actually able to convert the image to hexadecimal code and send it to nodemcu. The Problem is solved that's for that quick reply. Appreciated. 8-)
User avatar
kwagyeman
Posts: 3837
Joined: Sun May 24, 2015 2:10 pm

Re: Convert Image To Pixel Array

Postby kwagyeman » Wed Jul 10, 2019 5:36 pm

Please post the code snippet for others. Thank!
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: MSN [Bot] and 2 guests