showimg.m

来自「PCA MATLAB源代码」· M 代码 · 共 24 行

M
24
字号
function img=showimg(vet, height, wide)
% img=showimg(vet, height, wide)
%
% Function that shows the vector 'vet'
% as an image of size height * wide.

for col=1:wide,
   for lin = 1:height,
      img(lin, col) = vet((col-1)*height + lin);
   end
end

% Histogram stretch of the image:
minimum = min(min(img));
img = img - minimum + 1;
maximum = max(max(img));
coef = 256/(maximum); 

img = img*coef;

% Ploting the image: 
image(img); colormap(gray(256));
return

⌨️ 快捷键说明

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