⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 visual.m

📁 NMFs算法(带稀疏度约束的非负稀疏矩阵分解)用于实现基于人脸局部特征的人脸识别
💻 M
字号:
function visual( W, mag, cols, ysize )% visual - display a basis for image patches%% W        the basis, with patches as column vectors% mag      magnification factor% cols     number of columns (x-dimension of map)% ysize    [optional] height of each subimage%    % Is the basis non-negative    if min(W(:))>=0,    % Make zeros white and positive values darker, as in earlier NMF papers    W = -W;    maxi=0;    mini=min(W(:));    bgval = mini/2;else    % Make zero gray, positive values white, and negative values black    maxi = max(max(abs(W)));    mini = -maxi;    bgval = maxi;end    % Get maximum absolute value (it represents white or black; zero is gray)% This is the side of the windowif ~exist('ysize'), ysize = sqrt(size(W,1)); endxsize = size(W,1)/ysize;% Helpful quantitiesxsizem = xsize-1;xsizep = xsize+1;ysizem = ysize-1;ysizep = ysize+1;rows = ceil(size(W,2)/cols);% Initialization of the imageI = bgval*ones(2+ysize*rows+rows-1,2+xsize*cols+cols-1);for i=0:rows-1  for j=0:cols-1        if i*cols+j+1>size(W,2)      % This leaves it at background color          else      % This sets the patch      I(i*ysizep+2:i*ysizep+ysize+1, ...	j*xsizep+2:j*xsizep+xsize+1) = ...          reshape(W(:,i*cols+j+1),[ysize xsize]);    end      endend% Make a black borderI(1,:) = mini;I(:,1) = mini;I(end,:) = mini;I(:,end) = mini;I = imresize(I,mag);colormap(gray(256));iptsetpref('ImshowBorder','tight'); subplot('position',[0,0,1,1]);imshow(I,[mini maxi]);truesize;  drawnow

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -