📄 cbcldata.m
字号:
function V = cbcldata% cbcldata - read face image data from cbcl database%global imloadfunc; % This is where the cbcl face images residethepath = '../data/cbcl-face-database/face/';% Create the data matrixV = zeros(19*19,2429);% Read the directory listingD = dir(thepath);% Step through each image, reading it into the data matrix% Note: The (+2) is just to avoid '.' and '..' entriesfprintf('Reading in the images...\n');for i=1:2429, switch imloadfunc, case 'pgma_read', I = pgma_read([thepath D(i+2).name]); otherwise, I = imread([thepath D(i+2).name]); end V(:,i) = reshape(I,[19*19, 1]); if rem(i,100)==1, fprintf('[%d/24]',floor(i/100)); endendfprintf('\n');% Same preprocessing as Lee and SeungV = V - mean(V(:));V = V / sqrt(mean(V(:).^2));V = V + 0.25;V = V * 0.25;V = min(V,1);V = max(V,0);% Additionally, this is required to avoid having any exact zeros:% (divergence objective cannot handle them!)V = max(V,1e-4);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -