x2pgm.m

来自「this a SVM toolbox,it is very useful for」· M 代码 · 共 38 行

M
38
字号
function x2pgm(X,width,height,fname)% x2pgm(X,fname)%% X2PGM write an image from the vector X to the file fname%  in the PGM format. The vector is supposed to be double%  and normalized to <0,1>. The arguments width and height%  determine the shape of the image.%% Input:%  X [size x 1] contains input image of given size.%  width [1x1] width of the image.%  height [1x1] height of the image.%  fname [string] name of the file where the image is to be written.%%% See also PGM2X%% Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac% (c) Czech Technical University Prague, http://cmp.felk.cvut.cz% Written Vojtech Franc (diploma thesis)% Modifications% 26-feb-2001 V.Francfid=fopen(fname, 'w' );fprintf(fid, 'P5\n');fprintf(fid, '%d %d\n',width, height );fprintf(fid, '255\n' );X=uint8(X*255);fwrite(fid,X,'uchar');fclose(fid);return;

⌨️ 快捷键说明

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