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

📄 writepgm.m

📁 人脸识别matlab程序 with a principal components analysis for a set of face images as the theme
💻 M
字号:
function writepgm(image,filename)%WRITEPGM Write a matrix as a raw pgm file%         WRITEPGM(IMAGE,FILENAME) writes the array image as a raw PGM%         file to FILENAME.%% Matthew Dailey 1999if ~(image <= 255 & image >= 0)  error('Image pixels out of range.');end;% Open the file%fprintf(1,'Opening %s...\n',filename);fid = fopen(filename,'w');if fid <= 0  error(sprintf('Could not open %s for writing.',filename));end;width = size(image,2);height = size(image,1);% Write header informationfprintf(fid,'P5\n');fprintf(fid,'%d %d\n',width,height);fprintf(fid,'255\n');% Write the raw data -- transpose first thoughcount = fwrite(fid,image','uchar');if count ~= width*height  error(sprintf('Could not write all data to %s', outfile));end;fclose(fid);

⌨️ 快捷键说明

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