Effacer les filtres
Effacer les filtres

Ho can i imread all images in the Path

2 vues (au cours des 30 derniers jours)
abdullah al-dulaimi
abdullah al-dulaimi le 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]);

Réponse acceptée

Walter Roberson
Walter Roberson le 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
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 commentaire
abdullah al-dulaimi
abdullah al-dulaimi le 4 Nov 2022
thank you brother, i ask a a new question, check it please mybe you can help me.

Connectez-vous pour commenter.

Plus de réponses (0)


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!

Translated by