Ho can i imread all images in the Path

1 Ansicht (letzte 30 Tage)
abdullah al-dulaimi
abdullah al-dulaimi am 4 Nov. 2022
I have this Code for only one image, I want to convert code to imread all images in the path = ('C:\Users\hp\Desktop\New folder (4)\boss_256_0.4\cover')., and second path=
%% Getting the input images
% disp('Provide the main image...')
[img_file1, img_path1] = uigetfile({'*.png'});
img1 = imread([img_path1,img_file1]);

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 4 Nov. 2022
img_path1 = 'C:\Users\hp\Desktop\New folder (4)\boss_256_0.4\cover';
dinfo = dir( fullfile(img_path1, '*.png') );
filenames = fullfile({dinfo.folder}, {dinfo.name});
numfiles = length(filenames);
results = zeros(numfiles, SomethingAppropriate);
for K = 1 : numfiles
thisfilename = filenames{K};
img1 = imread(thisfilename);
%now process img1
results(K,:) = something appropriate
end
You might also want to start looking at the flows permitted by imageDatastore -- especially in combination with tools such as augmentedImageDatastore which can automatically resize and convert to rgb or grayscale, so that your later code does not need to worry about that.
  1 Kommentar
abdullah al-dulaimi
abdullah al-dulaimi am 4 Nov. 2022
thank you brother, i ask a a new question, check it please mybe you can help me.

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

Community Treasure Hunt

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

Start Hunting!

Translated by