Error using isrgb (line 8) Function ISRGB has been removed.

将以下代码保存为isrgb.m文件,然后放置到需要调用这个函数的m文件所在目录。

function y = isrgb(x)
%ISRGB Return true for RGB image.
%   FLAG = ISRGB(A) returns 1 if A is an RGB truecolor image and
%   0 otherwise.
%
%   ISRGB uses these criteria to determine if A is an RGB image:
%
%   - If A is of class double, all values must be in the range
%     [0,1], and A must be M-by-N-by-3.
%
%   - If A is of class uint8 or uint16, A must be M-by-N-by-3.
%
%   Note that a four-dimensional array that contains multiple RGB
%   images returns 0, not 1.
%
%   Class Support
%   -------------
%   A can be of class uint8, uint16, or double. If A is of 
%   class logical it is considered not to be RGB.
%
%   See also ISBW, ISGRAY, ISIND.

%   Copyright 1993-2003 The MathWorks, Inc.  
%   $Revision: 1.15.4.2 $  $Date: 2003/08/23 05:52:55 $

wid = sprintf('Images:%s:obsoleteFunction',mfilename);
str1= sprintf('%s is obsolete and may be removed in the future.',mfilename);
str2 = 'See product release notes for more information.';
warning(wid,'%s\n%s',str1,str2);

y = size(x,3)==3;
if y
   if isa(x, 'logical')
      y = false;
   elseif isa(x, 'double')
      % At first just test a small chunk to get a possible quick negative  
      m = size(x,1);
      n = size(x,2);
      chunk = x(1:min(m,10),1:min(n,10),:);         
      y = (min(chunk(:))>=0 && max(chunk(:))<=1);
      % If the chunk is an RGB image, test the whole image
      if y
         y = (min(x(:))>=0 && max(x(:))<=1);
      end
   end
end


  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值