フィルターのクリア

How to convert images folder to .mat

12 ビュー (過去 30 日間)
abdullah al-dulaimi
abdullah al-dulaimi 2022 年 7 月 12 日
コメント済み: Bhagavathula Meena 2022 年 9 月 24 日
I have this path ('C:\Users\hp\Desktop\testing\abood'), and i want to convert all images in this path to .mat file
  1 件のコメント
Debadipto
Debadipto 2022 年 7 月 12 日
Please refer to this answer. Hope this helps.

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

回答 (1 件)

KSSV
KSSV 2022 年 7 月 12 日
編集済み: KSSV 2022 年 7 月 12 日
thepath = 'C:\Users\hp\Desktop\testing\abood' ;
imgFiles = dir([thepath,'\*jpg']) ; % give your image extension
N = length(imgFiles) ;
for i = 1:N
imgFile = fullfile(imgFiles(i).folder,imgFiles(i).name) ;
I = imread(imgFile) ;
[filepath,name,ext] = fileparts(imgFile) ;
fname = [thepath,filesep,name,'.mat'] ;
save(fname,'I')
end
  7 件のコメント
KSSV
KSSV 2022 年 7 月 12 日
thepath = 'C:\Users\hp\Desktop\testing\abood' ;
imgFiles = dir([thepath,'\*jpg']) ; % give your image extension
N = length(imgFiles) ;
I = cell(N,1) ;
for i = 1:N
imgFile = fullfile(imgFiles(i).folder,imgFiles(i).name) ;
I{i} = imread(imgFile) ;
end
fname = [thepath,'myFile','.mat'] ;
save(fname,'I')
Bhagavathula Meena
Bhagavathula Meena 2022 年 9 月 24 日
I have been searching for the same context to my work . Thank you very much . its working .

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

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by