最近忙着畢業設計,主要是提取TID2008圖庫里的圖像的特征,然后用於分類器。其中用到matlab程序,提取特征存成excel的,第一列是圖片名字,第二列往后 是提取出來的特征。
其中圖片格式是bmp的
程序很簡單:
clc
clear all
close
pathname = uigetdir(cd, '請選擇文件夾');
if pathname == 0
msgbox('您沒有正確選擇文件夾');
return;
end
filesname = ls(strcat(pathname,'/*.bmp'));%strcat連接字符串
files = [cellstr(filesname)]; % 得到文件路徑
len = length(files); % 文件個數
for i=1:len;
image = imread(strcat(pathname,'\',files{i}));
I=rgb2gray(image);
imagefeature = feature_extract(double(I));
datas(i,:) = imagefeature;
end
%dlmwrite('featureblur.data',datas,'delimiter', ',','newline','pc');
xlswrite('featureblur.xls',datas,'sheet1','B1');%將特征寫入sheet1,從第二列(B1)開始
xlswrite('featureblur.xls',files,'sheet1','A1');%將特征寫入sheet1,從第一列(A1)開始