how can i read image from my google drive, process it and sent the output to my email address?, image after image, automatically?

46 次查看(过去 30 天)
I have a matlab program, named my_program (which is located in a desktop folder) that reads an image (eg image1.jpg) from the folder (by imread (image1.jpg)), processes it and outputs (the output is specific coordinates (x,y) in the image). I want to make that:
1. Input: The program will read the images from a folder in my cloud in Google Drive, automatically. Each time that new image is uploaded to the folder, the program reads it, processes it, and outputs the output. For simplicity, the first image is: image1.jpg, the second is: image2.jpg, the third is: image3.jpg etc.
2. Output: The output (the coordinates) will be sent to a folder in my cloud in Google Drive, or, even better, the output will be sent to my email address. My email address is: inon9999@gmail.com. After that I want that the program will delete the image (that already processed) from the folder in Google Drive.
The program will wait for a new image to be uploaded to the folder, and then it will read it, process it, send the output to my email, and delete it. And so on.
  2 个评论
Rik
Rik 2018-12-19
Matlab can send e-mails, so the only thing you really need to do is finding a workable API for Google Drive that will work on a slightly older release like R2014b. If there is anything, it will probably be on the File Exchange, and you have good chances on it working on your release.
inon hen
inon hen 2018-12-20
i succeed to send a text message to my email (string message) with the function 'sendmail', but I can not send to my email, values ​​of variables (the coordinates, which are within variables) and, I still do not know how to get the input from the folder in my drive

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2018-12-23
It looks like it might be possible to imread() an image out of google drive, once you have the file identifier.
I have a photo on drive. Normally if I ask for the shareable link for it in any of several ways, I get told it is at https://drive.google.com/open?id=0B6Z9gtnwRLLTMDVTRWptemVwemM . (Notice the lack of file extension.) But you cannot use
img = imread('https://drive.google.com/open?id=0B6Z9gtnwRLLTMDVTRWptemVwemM', 'jpg'); %fails
as it turns out to be a link to a web page.
The uc hint says to change the 'open' to 'uc'. And that appears to work:
img = imread('https://drive.google.com/uc?id=0B6Z9gtnwRLLTMDVTRWptemVwemM', 'jpg'); %works
imshow(img);
Now.. how to get the URL in the first place is a different question!
  8 个评论
Jordan Reid
Jordan Reid 2020-10-16
By downloading the Google Drive desktop app, Google Drive essentially becomes a folder accessible by MatLab and any other applications operating locally on the computer.

请先登录,再进行评论。

更多回答(2 个)

Image Analyst
Image Analyst 2018-12-19
See my attached email sending demo.
  7 个评论
inon hen
inon hen 2020-4-3
Hello Mei Sing
My program reads thermal images from a certain folder, processes them, and finds the coordinates of the center of the hot objects. The program displays a window showing the steps of finding the object centers. In addition, the program displays the coordinates of the object centers on the Matlab display and sends the coordinates to the recipients we determine by email
the recipients can be changed in "steps_function" in line 9.
"short_main" is the main script. "short_main" call to "steps_function" and "steps_function" call to "canny_detection".
Note that "short_main" (line 13) reads files from a folder that is in a specific location, so if you run the program from another computer you should check that the path of the folder from which the images are extracted is the correct path.
The images are called in the order of their name, starting from image1.jpg and then moving to image2.jpg and so on.
The program waits 60 seconds to read the next image from the folder. If no new image has been uploaded to the folder, the program stops running. You can change this time (the time the program waits for a new image to be uploaded to the folder) to be the time you want by changing the waitMax variable (found in "short_main" in line 9).
The maximum number of images that the program processes is one number less than the number found in the while loop in "short_main" in line 11. Currently, my program says: "while k<6", so that’s mean that the program will read and process a maximum of 5 images.
You need to know that you need to change lines 4,5 and 9 in the "steps_function" function to make it right for you.

请先登录,再进行评论。


Richard Zapor
Richard Zapor 2023-6-17
Two changes are required to download from a google drive.
1) Set the privilege to Anyone with the link for the file using the triple dots
2) Given a filename of below format: tweak- file/d to uc?export=download&id= while removing /view?usp=sharing
if resourcekey=RESOURCE_KEY exists then also include at the end per Overleaf
Works for urlwrite and imread
urlwrite('https://drive.google.com/uc?export=download&id=1v3GsGgP3p905wzdvUqypL_-djYmxiyzK','2.png');
img=imread('https://drive.google.com/uc?export=download&id=1v3GsGgP3p905wzdvUqypL_-djYmxiyzK','png')
img2=imread('https://drive.google.com/uc?export=download&id=1v3GsGgP3p905wzdvUqypL_-djYmxiyzK');
solution credit to https://www.overleaf.com/learn/how-to/How_can_I_upload_files_from_Google_Drive%3F

类别

Help CenterFile Exchange 中查找有关 Downloads 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by