フィルターのクリア

How to automate the following set of commands?

1 回表示 (過去 30 日間)
Kevin Akash Rajasekaran
Kevin Akash Rajasekaran 2021 年 3 月 15 日
コメント済み: Image Analyst 2021 年 3 月 17 日
Hey all! I'm fairly new to MATLAB and I'm working on a small project where I have to convert a database of images into a downsampled dataset of fixed resolution and other image properties. So for the following purpose, I am currently using the following commands in sequence for one image.
rec = db.info('filename');
img = freeviewing.analysis.getImg(rec,56.9781,32.0502,screen);
imwrite(img, 'example.png')
So before setting up the commands, I'm calling a image wrapper set up previously, which loads the downloaded image with the appropriate parameters through this command
>> db = imgdb.geisler('Directorypath');
Is there a way to automate the first three commands for every image file and save it as separate files? An example code which I can use would be much appreciated! Thanks!

採用された回答

Image Analyst
Image Analyst 2021 年 3 月 15 日
Sure. Just write a function. This link will probably show you how to do that:
maybe something like
function img = MyCustomFunction(db, fullFileName)
rec = db.info('filename');
img = freeviewing.analysis.getImg(rec,56.9781,32.0502,screen);
imwrite(img, fullFileName); % Save it to disk with the specified file name.
  4 件のコメント
Kevin Akash Rajasekaran
Kevin Akash Rajasekaran 2021 年 3 月 17 日
That's cool! Do you have an example code I can refer to for looping?
Image Analyst
Image Analyst 2021 年 3 月 17 日

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by