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

조회 수: 48 (최근 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.
Walter Roberson
Walter Roberson 2020년 10월 16일
Google Drive Desktop App was taken out of service several years ago. Now there is just Google Backup and Sync.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Image Analyst
Image Analyst 2018년 12월 19일
See my attached email sending demo.
  댓글 수: 7
Mei Sing Wang
Mei Sing Wang 2020년 4월 3일
Hi there.. I have same issue as well, may I know did you found your solution?
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