Matlab: How to use uigetdir and imread to read pictures in multiple folders?

first of all

Put the folder to be processed in the matlab project folder:
As shown in the picture, insert the picture description here
a code is shown below:

N_Step=6;
Add=[uigetdir(),'\'];   %选取文件的图片
for k=1:N_Step
    Name=[Add,num2str(7),'\',num2str((nfre-1)*N_Step+k),'.bmp'];
    %读取文件夹路径:拍摄\7\1~36.bmp
    I=double(imread(Name));
    I(:,:,k)=I_Plane1(:,:,1); %图片存储于I中以供后续处理
 end

uigetdir : select the folder
Name : the path of the folder read by imread, the value needs to be converted into a string, the format is: * \ * \ *
imread : read the picture under the specified path

Guess you like

Origin blog.csdn.net/qq_40797015/article/details/105482108