[Index for tmp_for_tar/vrml.doc]
[Return to Master Index]
writefi
(tmp_for_tar/vrml.doc/writefi.m)
Function Synopsis
writefi(fname, im)
Help text
writefi(fname, im)
writefi Write an image into a file in FI format: i.e, like PGM,
but magic number is: 'FI', and values are saved as
floats rather then integers.
writefi(fname, im)
fname - file name.
im - image to write into the file.
writefi(fid, im)
fid - file ID. File should be opened before calling
writepgm, and closed afterwards.
im - image to write into file.
Created: 23.5.98.
Version: 1.0
Listing of function file tmp_for_tar/vrml.doc/writefi.m
## writefi(fname, im)
##
## Copyright (C) 1998 Ariel Tankus
##
## This program is free software.
## This file is part of the Image Processing Toolbox for Octave
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##
## writefi Write an image into a file in FI format: i.e, like PGM,
## but magic number is: 'FI', and values are saved as
## floats rather then integers.
##
## writefi(fname, im)
## fname - file name.
## im - image to write into the file.
##
## writefi(fid, im)
## fid - file ID. File should be opened before calling
## writepgm, and closed afterwards.
## im - image to write into file.
##
## Author: Ariel Tankus <arielt@math.tau.ac.il>
## Created: 23.5.98.
## Version: 1.0
function writefi(fname, im)
## is input given as filename or file ID?
inputAsName = isstr(fname);
if (inputAsName)
fid = fopen(fname, 'w');
if (fid == -1)
error(['Unable to open file: ', fname]);
return;
end
else
fid = fname;
end
fprintf(fid, 'FI\n');
fprintf(fid, '%d %d\n', size(im,2), size(im,1));
## im', since matlab writes column-wise.
count = fwrite(fid, im', 'float', 0, 'ieee-be');
if count < prod(size(im))
fprintf('Warning: File data corrupted!');
end
if (inputAsName)
fclose(fid);
end
endfunction
Produced by oct2html on Sat Dec 2 19:08:39 2000
Cross-Directory links are: ON