pcxread.m

来自「有关matlab的电子书籍有一定的帮助希望有用」· M 代码 · 共 47 行

M
47
字号
function [X,map]=pcxread(filename);
%PCXREAD Read a PCX (ZSoft Paint Format) file from disk.
%   Note: PCXREAD has been grandfathered; use IMREAD instead.
%
%   [X,MAP]=PCXREAD('filename') reads the file 'filename' and returns
%   the indexed image X and associated colormap MAP.  The image 
%   is not displayed. If no extension is given for the filename,
%   the extension '.pcx' is assumed.
%
%   Note: Only 256 color PCX files are supported.
%
%   See also IMFINFO, IMREAD, IMWRITE.

%   Mounil Patel 7/20/93
%   updated to call IMREAD by Chris Griffin 8/15/96
%   Copyright 1993-1998 The MathWorks, Inc.  All Rights Reserved.
%   $Revision: 5.6 $  $Date: 1997/11/24 15:36:03 $

if (nargin~=1)
    error('Requires a filename as an argument.');
end;

if (isstr(filename)~=1)
    error('Requires a string filename as an argument.');
end;

if (isempty(findstr(filename,'.'))==1)
    filename=[filename,'.pcx'];
end;

[info,msg] = imfinfo(filename,'pcx');
if ~isempty(msg), 
    error(msg);
end

[X,map] = imread(filename, 'pcx');

if isempty(map) & ndims(X)==3   % RGB Truecolor image
    error('pcxread doesn''t read 24 bit PCX image files, use IMREAD instead');
end

X=double(X)+1;




⌨️ 快捷键说明

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