getRGB(img) - extracts the r, g, and b parts for a color image. [r,g,b,in] = getRGB(img,lumThresh) Returns the r, g, and b components of img as well as the intensity used for normalization in color opponency computations, i.e. max(r,g,b). r, g, and b values at locations with in < lowThresh are set to zero. [r,g,b,in] = getRGB(img) Use lumThresh = 0.1 as default. See also makeRedGreenPyramid, makeBlueYellowPyramid.
0001 % getRGB(img) - extracts the r, g, and b parts for a color image. 0002 % 0003 % [r,g,b,in] = getRGB(img,lumThresh) 0004 % Returns the r, g, and b components of img as well as 0005 % the intensity used for normalization in color 0006 % opponency computations, i.e. max(r,g,b). 0007 % r, g, and b values at locations with in < lowThresh 0008 % are set to zero. 0009 % 0010 % [r,g,b,in] = getRGB(img) 0011 % Use lumThresh = 0.1 as default. 0012 % 0013 % See also makeRedGreenPyramid, makeBlueYellowPyramid. 0014 0015 % This file is part of the SaliencyToolbox - Copyright (C) 2006-2007 0016 % by Dirk B. Walther and the California Institute of Technology. 0017 % See the enclosed LICENSE.TXT document for the license agreement. 0018 % More information about this project is available at: 0019 % http://www.saliencytoolbox.net 0020 0021 function [r,g,b,in] = getRGB(img,varargin) 0022 0023 if isempty(varargin) 0024 lumThresh = 0.1; 0025 else 0026 lumThresh = varargin{1}; 0027 end 0028 0029 r = img(:,:,1); 0030 g = img(:,:,2); 0031 b = img(:,:,3); 0032 in = max(max(r,g),b); 0033 0034 % set everything below the luminance threshold to zero 0035 lowIn = (in < lumThresh); 0036 r(lowIn) = 0; 0037 g(lowIn) = 0; 0038 b(lowIn) = 0;