模式识别中的图像特征提取与预处理
1. 图像读取与显示
在进行模式识别时,首先需要读取和显示图像。以下是一段MATLAB代码,用于读取图像并显示:
for CL = 1: NC
for SA = 1: NT
class = num2str(CL);
sample = num2str(SA);
I{CL,SA} = imread(strcat(path,class,' (',sample,')',ext));
end;
fprintf(' %d\n', CL)
end;
for i = 1:NC
% do for all classes
for j = 1:NT
% do for all samples per class
k = j+(i-1)*NT;
subplot(NC, NT, k),imshow(I{i,j}), title(strcat(num2str(i),'-',num2str(j)));
end;
end;
另外,还可以使用 imageDatastore 函数来读取图像并使用 montage 函数显示:
clear;
loc = fullfile(matlabroot, 'toolbox', 'images', 'imdata');
imds = imageDatastore(loc,'
超级会员免费看
订阅专栏 解锁全文


被折叠的 条评论
为什么被折叠?



