前言

工程实现的过程中经常需要依次读取文件夹中的图像(或者其他文件),本文就对此进行实现。

代码

% /************************************************************************
% * Copyright(c) 2017 Amy
% * All rights reserved.
% * File: test.m
% * Brief:
% * Version: 1.0
% * Author: Amy
% * Email:
% * Date: 2017/09/22
% * Reference:
% * History:
%
% ************************************************************************/
clc
clear
close all
test_path = '.\test\';
test_list = dir(strcat(test_path, '*.png'));%某类文件格式
test_number = length(test_list);%获取图像总数量
for j = 1:test_number %逐一读取图像
image_name = test_list(j).name;% 图像名
img = im2uint8( imread(strcat(test_path, image_name)) );
%TODO

end