Closed hpssjellis closed 1 year ago
A good starting point would be how to Serial.print() the encoded PNG?
Are you asking how to output it as BASE64 or hex to the serial monitor?
As far as I know a Base64 image to show on a webpage is just the raw data from a PNG presented in this form:
data:image/png;base64,R0lGODdhAQABAPAAAP8AAAAAACwAAAAAAQABAAACAkQBADs=
The above is a very small red dot.
For my code I am trying to write the PNG to the serial monitor in HEX format and then to a webpage using client.write(); in the format above so that the PNG can be shown on the webpage. I guess I could also save the PNG as a file on the SD card and display it on the webpage as a PNG, but I am trying to skip that step.
An extra problem is client.write() needs the entire set of data in one shot and not to loop through each digit as it is much too slow.
My testing (Portenta and Nicla-Vision) repository is here https://github.com/hpssjellis/my-examples-for-the-arduino-portentaH7/tree/master/research/camera-webserver-save
I'm still not clear on what part you need help with. Your png encoding example looks ok, but you don't do anything with the output data. I would suggest writing the hex data to the http connection is reasonable sized chunks (e.g. 512 bytes at a time). See how that works. Are you unclear how to format the text to be acceptable for the web connection? You can use a keep-alive type of connection and write multiple times before closing it.
Hi Larry
Both your PNG libraries seem to run fine on the Portenta and Nicla Vision. I don't need to save the data to SD card I just need to convert the Arduino camera FrameBuffer to PNG and then serial.print it to the monitor (or client.write it to a website).
I think I can do the conversion but if you have any suggestions, or problems you think I might have, I would be interested in hearing them.
defined at https://github.com/arduino/ArduinoCore-mbed/blob/master/libraries/Camera/src/camera.h
camera example at
https://github.com/arduino/ArduinoCore-mbed/blob/master/libraries/Camera/examples/CameraCaptureRawBytes/CameraCaptureRawBytes.ino