本站提供最佳trc20充提币源码服务,欢迎转载和分享。

【byebye极域源码】【微软ping命令源码】【易语言源码音乐】matlab眼睛定位源码_matlab怎么定位眼睛

2024-11-15 06:11:23 来源:系统交易指标源码 分类:探索

1.求MATLAB里imread这个函数的眼睛源码眼睛byebye极域源码源代码

matlab眼睛定位源码_matlab怎么定位眼睛

求MATLAB里imread这个函数的源代码

       function [X, map, alpha] = imread(varargin)

       [filename, format, extraArgs, msg] = parse_inputs(varargin{ :});

       if (~isempty(msg))

        error('MATLAB:imread:inputParsing', '%s', msg);

       end

       % Download remote file.

       if (strfind(filename, '://'))

        url = true;

        if (~usejava('mwt'))

        error('MATLAB:imread:noJava', 'Reading from a URL requires a Java Virtual Machine.')

        end

        try

        filename = urlwrite(filename, tempname);

        catch

        error('MATLAB:imread:readURL', 'Can''t read URL "%s".', filename);

        end

       else

        url = false;

       end

       if (isempty(format))

        % The format was not specified explicitly.

        % Verify that the file exists.

        fid = fopen(filename, 'r');

        if (fid == -1)

        if ~isempty(dir(filename))

        error('MATLAB:imread:fileOpen', ['Can''t open file "%s" for reading;\nyou' ...

        ' may not have read permission.'], ...

        filename);

        else

        error('MATLAB:imread:fileOpen', 'File "%s" does not exist.', filename);

        end

        else

        % File exists. Get full filename.

        filename = fopen(fid);

        fclose(fid);

        end

        % Try to determine the file type.

        format = imftype(filename);

        if (isempty(format))

        error('MATLAB:imread:fileFormat', 'Unable to determine the file format.');

        end

       else

        % The format was specified explicitly.

        % Verify that the file exists.

        fid = fopen(filename, 'r');

        if (fid == -1)

        % Couldn't open using the given filename; search for a

        % file with an appropriate extension.

        fmt_s = imformats(format);

        if (isempty(fmt_s))

        error('MATLAB:imread:fileFormat', ['Couldn''t find format %s in the format registry.' ...

        ' See "help imformats".'], format);

        end

        for p = 1:length(fmt_s.ext)

        fid = fopen([filename '.' fmt_s.ext{ p}]);

        if (fid ~= -1)

        % The file was found. Don't continue searching.

        break

        end

        end

        end

        if (fid == -1)

        if ~isempty(dir(filename))

        error('MATLAB:imread:fileOpen', ['Can''t open file "%s" for reading;\nyou' ...

        ' may not have read permission.'], ...

        filename);

        else

        error('MATLAB:imread:fileOpen', 'File "%s" does not exist.', filename);

        end

        else

        filename = fopen(fid);

        fclose(fid);

        end

       end

       % Get format details.

       fmt_s = imformats(format);

       % Verify that a read function exists

       if (isempty(fmt_s.read))

        error('MATLAB:imread:readFunctionRegistration', 'No reading function for format %s. See "help imformats".', ...

        fmt_s.ext{ 1});

       end

       if ((fmt_s.alpha) && (nargout == 3))

        % Use the alpha channel.

        [X, map, alpha] = feval(fmt_s.read, filename, extraArgs{ :});

       else

        % Alpha channel is not requested or is not applicable.

        alpha = [];

        [X, map] = feval(fmt_s.read, filename, extraArgs{ :});

       end

       % Delete temporary file from Internet download.

       if (url)

        delete_download(filename);

       end

       %%%

       %%% Function delete_download

       %%%

       function delete_download(filename)

       try

        delete(filename);

       catch

        warning('MATLAB:imread:tempFileDelete', 'Can''t delete temporary file "%s".', filename)

       end

       %%%

       %%% Function parse_inputs

       %%%

       function [filename, format, extraArgs, msg] = ...

        parse_inputs(varargin)

       filename = '';

       format = '';

       extraArgs = { };

       msg = '';

       % Parse arguments based on their number.

       switch(nargin)

       case 0

        % Not allowed.

        msg = 'Too few input arguments.';

        return;

       case 1

        % Filename only.

        filename = varargin{ 1};

       otherwise

        % Filename and format or other arguments.

        filename = varargin{ 1};

        % Check whether second argument is a format.

        if (ischar(varargin{ 2}))

        fmt_s = imformats(varargin{ 2});

        else

        fmt_s = struct([]);

        end

        if (~isempty(fmt_s))

        % The argument matches a format.

        format = varargin{ 2};

        extraArgs = varargin(3:end);

        else

        % The argument begins the format-specific parameters.

        extraArgs = varargin(2:end);

        end

       end

【本文网址:http://04.net.cn/html/4d432495671.html 欢迎转载】

copyright © 2016 powered by 皮皮网   sitemap