-
-
Notifications
You must be signed in to change notification settings - Fork 195
-
-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Useful Camera Examples #482
Comments
Hear, hear! |
+1 |
We're currently having a look at 3. and 4.. |
@sebromero not sure if it is helpful, but this repo has camera saving to sd card and then cellular transfer for the sony spressense https://github.com/edgeimpulse/ei-spresense-4g-wildlife-camera/blob/main/wildlife-camera-sketch/4g_camera.ino |
Hi all! There is an update on 4. @marqdevx wrote a great tutorial on how to do this. Check it out here: https://docs.arduino.cc/tutorials/portenta-vision-shield/camera-to-bitmap-sd-card |
@marqdevx Thank you so much for the excellent example. I notice that the code is only for the PortentaH7 and not for both the Portenta and Nicla Vision like the standard examples:
Any suggestions for running a similar example for the color/grayscale camera on the Nicla Vision? |
Thanks!! @hpssjellis We did not add the Nicla Voice compatibility cause it does not have an SD Card out of the box. But you could use the same settings:
You could also use the RGB565, but you may tweak the sketch. I need to check it out, I think it needs some additions to be compatible with the RGB 565 format |
@marqdevx Thanks so much for the quick reply. My actual goal is to transfer a very small 96x96 image offsite (perhaps using WiFi on the Nicla Vision ), so saving to the SD Card is not as relevant as the bigger goal. That is why the original request included some kind of standard compression such as PNG or JPEG so that the image from the Portenta or Nicla Vision is more widely useable. Presently the generated bitmap can not be imported into edgeimpulse.com without some extra image manipulation which makes the process to unwieldy to teach high school kids. If you can have a look at it that would be awesome, I will also try some research on my side. Link to good PNG manipulation site https://github.com/bitbank2/PNGenc Link to good JPEG manipulation site https://github.com/bitbank2/JPEGENC |
I've tested some converters to convert the bitmap to a PNG but it didn't have compatibility for the mbed Core, I will check those out to see if we are lucky. Also I would love to see that transfer sketch hehe 👀 |
The data transfer to webpage sketch is being worked on with a friend from Italy, not sure if it is ready for viewing yet. I will check with him. The sketch is just for sensor data, I am the one that wants to make it web transfer a small image. |
WebSave of camera data here https://github.com/hpssjellis/my-examples-for-the-arduino-portentaH7/blob/master/research/camera-webserver-save/cam07-websave2.ino I eventually want grayscale 96x96 but this is bigger and very slow to load almost 30 seconds and the base64 encoded image is not correct. The save text file feature is kind of cool. |
@hpssjellis Interesting example. I'd love to see this working. What makes it slow, the transfer over WiFi or the base64 encoding? We could consider adding GZIP to the mix to make it faster if it's the WiFi that makes it slow. |
The main example is loading data into the textarea and then easily saving the text to a .txt file. I thought that was a security issue and not allowed, but it works fine. My code does not actually encode to base64 and that is why the image does not yet work, so the slow point is simply the client.write() function, and JZIP probably won't help too much. I will be working on the code over the next while. |
The big problem is that the Portenta fb camera data is not in PNG format. That is all that is needed now for this method to work. The new version has almost no delay. I am now testing it on the Nicla Vision If you put raw PNG data into the textarea and click view image as base64 image it works fine. |
Interesting that edgeimpulse has converted portenta images to JPEG. Also using Larry's JPEG converter. Link to good PNG manipulation site https://github.com/bitbank2/PNGenc Link to good JPEG manipulation site https://github.com/bitbank2/JPEGENC |
Does anyone know where the definitions for the class
I am trying to get PNG conversion of Camera data working on both the Portenta and NiclaVision which would be huge since it is a web standard, and I am fairly close, what would also help is a link to the old Arduino I am working on getting this code here working but then need to do much more to get the camera and web server an active part of the code. |
My issues is how to use fprintf, fread, fseek, fopen, fclose and fwrite. I am having success with fprintf, fwrite and fclose. Also finding examples for the others such as:
for fread here
and fwrite here
to me it looks like fprintf and fseek have the file as the first argument and fread and fwrite have the file as the last argument. |
So I can convert a Portenta or Nicla Vision image data into a PNG and then convert it to Base64 and upload a 16x16 PNG image to a website here Note: larger images work but the website often times-out after 30 seconds, but that whole process is kind of ridiculous. You have a low power device doing all the work and sending data to a high power device to view a webpage. What would make more sense is to send the raw data from the Portenta or Nicla Vision to the website and let the website javascript do the conversions to BMP PNG or JPEG and then to Base64 if needed and the webpage to allow saving of the images either to disk or local storage. I can probably do the last part but what I am having trouble with is sending the raw byte data through the arduino webserver to a webpage. Whenever I google search I get info on how to convert to Base64 or how to load a saved image. I will look into littleFS to save the image to a file system in memory, that simplifies some things especially for the Nicla Vision which does not have an SDCard but also adds a potentially slow step. Best would be to load raw image bytes directly to the generated webpage. I know javascript Blobs can process it, I just don't have any working examples. Any arduino people experts with Javascript and working with Byte arrays? I thought I was the Javascript expert :) , but seem a bit stumped here. |
I will close this as I have updated my Arduino IDE library "Portenta Pro Community Solutions" (search for See the folder dot36 here for most of them |
Feature Request: Useful Camera Examples
Since the Portenta Vision Shields (Lora and Ethernet) work for both the PortentaH7 (lite, connected) and soon the PortentaX8, it would be useful to have a few camera examples that are more complete than the raw demo already supplied.
I have successfully made Portenta Examples for most other functions on my "Portenta Pro Community Solutions" Arduino IDE library just search for "Community", but the camera eludes me. The MBED Portenta is slightly different than other Arduinos making out-of-the-box Arduino examples not work.
Best would be to have several small examples such as:
but might be easier to group these all together into one example:
Grouped example: Camera QR-code reader that shows the QR code on a Grayscale OLED and then converts to JPEG/PNG and saves to the Portenta SDCard. An example like that would show all the necessary tricks needed to build from there.
@facchinm @sebromero @giulcioffi @manchoz @per1234 @pennam
I would be willing to work with an Arduino Dev who could see my code and give some suggestions. My basic Portenta Camera examples are here . I have no idea where to start with converting the code to the MBED Portenta for QR-code, PNG or JPEG or saving a compressed image to the Portenta-SD-card
The text was updated successfully, but these errors were encountered: