MATLAB Answers

Can we upload image to Thingspeak?

75 views (last 30 days)
Current situation:
I have saved my processed image in raspberry pi. I would like to upload the image to Thingspeak. However, I came across some posts saying that we cant upload image to Thingspeak. I wish to view my image at Thingspeak and also at Thingview(mobile app).
Questions:
1) Can we upload image to Thingspeak?
2) Or can i upload the image to Google Drive then link it back to Thingspeak ?
3) If no, any way to do it?
This is the example that show the image, but I not sure how it does.

  3 Comments

Rene Chan
Rene Chan on 31 Mar 2020
I’m interested in knowing more about your use case. Specifically, I want to understand more of the following if you don’t mind sharing:
  • Is the image acquired and processed just once for static display? Or is it more like repeatedly acquired and processed for dynamics display?
  • What kind of processing or analysis do you perform on the image?
Mei Sing Wang
Mei Sing Wang on 1 Apr 2020
Hi, I am currently doing my final year project regarding on Iot Urban Farming, which I use Pi NoIR camera together with raspberry pi 3B+ in order to perform NDVI (Normalized Difference Vegetation Index) image. I want my camera to take picture at specific time every day and perform NDVI, then upload to Iot platform which we can visualize anytime.
There are two ways I would like to achieve:
1) Either show the NDVI image or
2) Plot the NDVI value to graph
Which way will be easier to achieve...
Currently, I have done my python script for:
1) Take picture at scheduled time
2) Process and show NDVI image and save to a specific folder in raspberry pi
Now I would like to upload it to an IoT platform(currently using Thingspeak) and I am kind of confused that should I:
1) continue work on python script to upload the image, or
2) work on Matlab visualization code
I am a total beginner on writing python code.
If I work on Matlab visualization code, is this where i should write my code?
Rene Chan
Rene Chan on 3 Apr 2020
Thanks for sharing the details!
One way to help you decide between the two next steps you are contemplating is to think about edge (on device) vs. cloud (ThingSpeak) processing.
Edge processing allows you to perform lighter duty computation on the device and then write the result to the cloud. It is easily achievable with you current implementation on the Pi and write the result to a ThingSpeak channel for basic visualization. It is a good starting point. What you will be missing is the additional analysis/processing of the images that is either impractical or impossible to do on the Pi.
Here's where the cloud processing like ThingSpeak with MATLAB comes in. For that to work, the raw data (images in this case) must be made available to ThingSpeak. ThingSpeak currently does not directly support collecting image as part of data write. But you can do what Christopher suggested by sending it to a third-party storage. You can then use MATLAB Visualization in ThingSpeak to perform computation and display the result on a channel.

Sign in to comment.

Accepted Answer

Christopher Stapels
Christopher Stapels on 31 Mar 2020
Edited: Vinod on 31 Mar 2020
At present, it is not easy to upload images to ThingSpeak. You could break it up into multiple fields and feeds, but it would require a lot of code and probably small images.
I suspect you can use google drive, though I haven't yet. The plant channel you linked uses a static image in the MathWorks documetation.
I used dropbox for the image on this channel. Here is the MATLAB visualization code. If you are using Dropbox, the key part is the dl=1 at the end of the URL.
myFig=figure( 'Position',[50 10 100 1000]);
bob=imread('https://www.dropbox.com/s/xxxxxxxxxxx/LoraBox_in_Flowers.jpg?dl=1');
myFig=imshow(bob);

  1 Comment

Mei Sing Wang
Mei Sing Wang on 1 Apr 2020
Thank you, I will try to work on how to upload my image to Google Drive or Dropbox first haha. I am a beginner hence it takes a lot of time. Thanks!

Sign in to comment.

More Answers (1)

Vinod
Vinod on 31 Mar 2020
Edited: Vinod on 1 Apr 2020
If you are using a Raspberry Pi, you can set up the IP camera functionality on it and then use the IP camera in a MATLAB visualization on ThingSpeak.
For example, try this code that reads from a public IP camera in a MATLAB visualization:
imshow(webread('http://24.73.89.162/axis-cgi/jpg/image.cgi',weboptions('ContentType','image')),'border','tight');
title(sprintf('Last updated at: %s',datetime('now')))

  0 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!