フィルターのクリア

how to save an image dataset into a specific folder

2 ビュー (過去 30 日間)
Hend Abouche
Hend Abouche 2022 年 3 月 14 日
コメント済み: Voss 2022 年 3 月 15 日
Hello everyone, I'm trying to read from a folder and apply pre-processing techniques on an images dataset and then save the dataset to another folder, but it's not working for me,
here is my code and thanks in advance for your help
clear
close all;
Source = "my_dataset_source";
imds = imageDatastore(Source,"IncludeSubfolders",true,"FileExtensions",".jpg");
for i= 1 :size(imds.Files,1)
I = readimage(imds,i);
%*************************processing images
FileName = fullfile('D:\targetfolder',sprintf('%d.jpg',i));
imwrite(I,sprintf('%d.jpg',i),'jpg');
end

採用された回答

Voss
Voss 2022 年 3 月 14 日
FileName = fullfile('D:\targetfolder',sprintf('%d.jpg',i));
imwrite(I,FileName,'jpg');
  2 件のコメント
Hend Abouche
Hend Abouche 2022 年 3 月 15 日
thank you for your answer, It worked
Voss
Voss 2022 年 3 月 15 日
You're welcome!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by