matlab 批量读取.jpg图片

时间:2025-03-28 17:24:25
% 如果你的图片命名方式是 .........
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'],'jpg');%如果你的图片命名方式是 .........则需要把first去掉,总之                                                                                            %first那部分灵活运用