%% import pictures, and save into images{img_num}
function [images] = import_data(file_path)
% 批量讀取圖片
img_path_list = dir(strcat(file_path,'*.jpg'));%獲取該文件夾中所有jpg格式的圖像
img_num = length(img_path_list);%獲取圖像總數量
images = cell(1, img_num);
if img_num > 0 %有滿足條件的圖像
for i = 1:img_num %逐一讀取圖像
image_name = img_path_list(i).name;% 圖像名
images{i} = im2bw(imread(strcat(file_path, image_name)));
% fprintf(' %d %s\n',i,strcat(file_path,image_name));% 顯示正在處理的圖像名
end
end
end