直接上代碼:
% 如果你的圖檔命名方式是1.bmp 2.bmp.......
clear;clc;
file_path = '你的需要處理的圖檔的檔案夾路徑\';
img_path_list = dir(strcat(file_path,'*.bmp'));
img_num = length(img_path_list);
if img_num > 0
for j = 1:img_num
image = imread(strcat(int2str(j),'.bmp'));
% % 或者
% image_name = img_path_list(j).name;
% image = imread(strcat(file_path,image_name));
end
end
% 如果你的圖檔命名方式是first1.jpg first2.jpg....first50.jpg.....
clear all;
clc;
file_path1 ='C:\Users\Administrator\Desktop\1\';
img_path_list1 = dir(strcat(file_path1,'*.jpg'));
Len= length(img_path_list1); % 擷取圖像總數量 (三個圖檔檔案夾中圖檔數量一緻)
for k=1:Len
Img = imread([file_path1,'first',num2str(k),'.jpg']);
imshow(Img)
end
% 如果你的圖檔命名方式是first00001.bmp first00002.bmp.......first00050.bmp
clear;clc;
file_path = '你的需要處理的圖檔的檔案夾路徑\';
img_path_list = dir(strcat(file_path,'*.bmp'));
img_num = length(img_path_list);
if img_num > 0
for j = 1:img_num
is=num2str(Startframe1);
number = '00000'; % 這個可以是五個0 也可以是6個0等
number(end-length(is)+1:end)=is;
filename11=[ file_path1 'first' number '.bmp'];
image = imread(filename11);
end
end
% 侵删