automatically updating input image

How can i change the input image in a matlab code on periodically automatically and keep the code running, everytime for the new images? Currently, i am using imread to read the image. every time i get a new image, i have to change the file, and run the code again. is there some way to do it automatically?

回答 (2 件)

Walter Roberson
Walter Roberson 2015 年 5 月 27 日

0 投票

[filename, filepath] = uigetfile('Pick one');
imagename = fullfile(filepath, filename);
YourImage = imread(imagename);
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh 2015 年 5 月 27 日
編集済み: Salaheddin Hosseinzadeh 2015 年 5 月 27 日

0 投票

Hi,
Have a look at the uigetfile command see if helps.
If not then you can specify a folder, read all the files inside a specific folder genpath and if you save the files according to a specific rules, lets say incrementally (mypciture_sunset_@ 1.jpg MyPic_landscape_@ 2.jpg) they don't need to have the same name necessarily, then you can find the file with a higher number strtok or most recent image and read it!
I would do the second one as it's 100% automatic.
Hope this helps.
Good luck!

カテゴリ

ヘルプ センター および File ExchangeEnvironment and Settings についてさらに検索

質問済み:

2015 年 5 月 27 日

編集済み:

2015 年 5 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by