1.求MATLAB里imread这个函数的眼睛源码眼睛源码加密授权ip源代码
求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
2025-01-19 10:59782人浏览
2025-01-19 10:56442人浏览
2025-01-19 10:39362人浏览
2025-01-19 10:33276人浏览
2025-01-19 09:12515人浏览
2025-01-19 08:461813人浏览
中国消费者报杭州讯记者施本允)近日,位于浙江省杭州市拱墅区的国大城市广场放心消费商圈标准化试点项目顺利通过杭州市标准化试点项目评估验收,成为杭州市消费领域唯一获评项目,也是拱墅区深耕“放心消费在浙江”
總台記者5月31日獲悉,印度比哈爾邦近日因高溫天氣已造成至少19人死亡。當地時間5月29日,印度首都新德里的一個氣象觀測點記錄了今年的最高氣溫,為52.3攝氏度,為有記錄以來的最高氣溫。來源:央視新聞
1700更新:12人落海都已尋獲)宜蘭縣頭城外海今7)天下午3點多發生船隻翻覆意外,事發地點位於頭城鎮大里漁港1海浬處,海巡獲報後出動海巡艇、協調漁船前往救援;目前落海的12人都已經尋獲,其中包括1位