MATLAB batch reads pictures under a folder

file_path = 'D:\mormal_dibright\';% image folder path  
img_path_list = dir(strcat(file_path,'*.bmp'));% get all images in bmp format in this folder  
img_num = length(img_path_list);% Get the total number of images 
I=cell(1,img_num);
if img_num > 0 % there are images that meet the conditions  
        for j = 1:img_num % read images one by one  
            image_name = img_path_list(j).name;% image name  
            image = imread( strcat(file_path,image_name));  
            I{j}=image;
           fprintf('%d %d %s\n',i,j,strcat(file_path,image_name));% Display the image name being processed  

            % The image processing process is omitted  

            % Here you can directly access the data by accessing the cell metadata

        end  
end  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324731094&siteId=291194637