How to save multiple images using imwrite in matlab ?

9 Ansichten (letzte 30 Tage)
Armylia Dewi
Armylia Dewi am 31 Mai 2022
Kommentiert: Armylia Dewi am 31 Mai 2022
How to save multiple images gray format .jpeg using imwrite in matlab ?
image_folder ='E:\gambar_eror'
filenames = dir (fullfile(image_folder,'*.jpeg'))
total_images = numel(filenames);
%training=[];
for n= 1:total_images;
f= fullfile(image_folder, filenames(n).name);
disp(f);
our_images= imread (f);
size (our_images);
gray=rgb2gray(our_images);
end

Akzeptierte Antwort

KSSV
KSSV am 31 Mai 2022
Bearbeitet: KSSV am 31 Mai 2022
image_folder ='E:\gambar_eror'
filenames = dir (fullfile(image_folder,'*.jpeg'))
total_images = numel(filenames);
%training=[];
for n= 1:total_images;
f= fullfile(image_folder, filenames(n).name);
disp(f);
[FILEPATH,NAME,EXT] = fileparts(f) ;
our_image= imread (f);
gray=rgb2gray(our_image);
filename = [image_folder,'\',NAME,'_gray',EXT] ;
imwrite(gray,filename)
end
  5 Kommentare
KSSV
KSSV am 31 Mai 2022
You can read the documentation. Read about those functions.
fileparts: This gives, the path of the file, name of the file and extension of the file.
[]: This will join the strings. This line, creates the image name.
Armylia Dewi
Armylia Dewi am 31 Mai 2022
Okay. Thankyou so much for the answer and discussion.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by