画像ファイルに番号を順番につけたい。
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
上図のように、あるフォルダーの中に適当な名前がついている画像ファイルがたくさんあります。
これを下図のように、順番に1番から連番で番号付けをしたいと考えています。更に、その連番になった画像ファイルを別フォルダーに保存したいと考えています。(ちなみにjpgファイルです)
(1番から順に連番になっていれば、上図と下図の画像ファイルの順番がバラバラでも問題ありません)
ご教示いただけると幸いです。宜しくお願い致します。
0 commentaires
Réponse acceptée
Atsushi Ueno
le 23 Oct 2022
impath = uigetdir(pwd); % 画像が含まれるフォルダを選択する
imds = imageDatastore(impath); % イメージデータストア作成
imds.writeall(impath) % 選択フォルダ内にバックアップを作成しておく
for k = 1:length(imds.Files)
[path, name, ext] = fileparts(imds.Files{k}); % パス、ファイル名、拡張子を取得
movefile(imds.Files{k}, [path filesep num2str(k) ext]); % ファイル名を変更する
end
imformats
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Convert Image Type dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!