saveinr.m
来自「这是一个基于MATLAB的机器视觉工具箱,里面用很多非常有价值的的程序」· M 代码 · 共 47 行
M
47 行
%SAVEINR Write an INRIMAGE format file%% SAVEINR(filename, im)%% Saves the specified image array in a INRIA image format file.%% SEE ALSO: loadinr%% Copyright (c) Peter Corke, 1999 Machine Vision Toolbox for Matlab% Peter Corke 1996function saveinr(fname, im) fid = fopen(fname, 'w'); [r,c] = size(im'); % build the header hdr = []; s = sprintf('#INRIMAGE-4#{\n'); hdr = [hdr s]; s = sprintf('XDIM=%d\n',c); hdr = [hdr s]; s = sprintf('YDIM=%d\n',r); hdr = [hdr s]; s = sprintf('ZDIM=1\n'); hdr = [hdr s]; s = sprintf('VDIM=1\n'); hdr = [hdr s]; s = sprintf('TYPE=float\n'); hdr = [hdr s]; s = sprintf('PIXSIZE=32\n'); hdr = [hdr s]; s = sprintf('SCALE=2**0\n'); hdr = [hdr s]; s = sprintf('CPU=sun\n#'); hdr = [hdr s]; % make it 256 bytes long and write it hdr256 = zeros(1,256); hdr256(1:length(hdr)) = hdr; fwrite(fid, hdr256, 'uchar'); % now the binary data fwrite(fid, im', 'float32'); fclose(fid)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?