📄 saveimg.m
字号:
function saveimg(I,filename)
%$Id: saveimg.m,v 1.1.1.1 2000/10/16 09:30:40 mattb Exp $
%===========================================================================
% Matt Bowers - University of Bath
%
% Copyright (c) 1996
%===========================================================================
%
% Save a MATLAB matrix as a P5 format image file.
%
% Arguments:
% filename destination filename including extension
% I image matrix
%
%===========================================================================
file_ID=openfile(filename,'w'); % Open file
fprintf(file_ID,'P5\n'); % Write header info
fprintf(file_ID,'# Created by saveimg.m\n');
% rows = height
% cols = width
%
[rows, cols] = size(I);
fprintf(file_ID,'%d %d\n',[cols rows]);
fprintf(file_ID,'%d\n',255);
% Matlab writes in column order, so we must transpose the data first
%
fwrite(file_ID, I', 'uchar');
shutfile(file_ID); % Close file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -