필터 지우기
필터 지우기

Ho can i imread all images in the Path

조회 수: 1 (최근 30일)
abdullah al-dulaimi
abdullah al-dulaimi 2022년 11월 4일
댓글: abdullah al-dulaimi 2022년 11월 4일
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]);

채택된 답변

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by