Home > SaliencyToolbox > removeColorFeatures.m

removeColorFeatures

PURPOSE ^

removeColorFeatures - removes color features from the saliency

SYNOPSIS ^

function params = removeColorFeatures(params,fid)

DESCRIPTION ^

 removeColorFeatures - removes color features from the saliency
 parameters.

 params = removeColorFeatures(params)
   removes all features from params that require a color image.

 params = removeColorFeatures(params,0)
   suppresses the warning.

 See also defaultSaliencyParams, runSaliency, dataStructures.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % removeColorFeatures - removes color features from the saliency
0002 % parameters.
0003 %
0004 % params = removeColorFeatures(params)
0005 %   removes all features from params that require a color image.
0006 %
0007 % params = removeColorFeatures(params,0)
0008 %   suppresses the warning.
0009 %
0010 % See also defaultSaliencyParams, runSaliency, dataStructures.
0011 
0012 % This file is part of the SaliencyToolbox - Copyright (C) 2006-2013
0013 % by Dirk B. Walther and the California Institute of Technology.
0014 % See the enclosed LICENSE.TXT document for the license agreement.
0015 % More information about this project is available at:
0016 % http://www.saliencytoolbox.net
0017 
0018 function params = removeColorFeatures(params,fid)
0019 
0020 if nargin < 2
0021   fid = 1;
0022 end
0023 
0024 colorTypes = {'Color','Hue','Skin'};
0025 
0026 numFeats = length(params.features);
0027 idx = [1:numFeats];
0028 
0029 for f = 1:numFeats
0030   if ismember(params.features{f},colorTypes)
0031     if (fid ~=0)
0032       fprintf(fid,['Warning: Trying to use feature ''' params.features{f} '''\n' ...
0033                    'for a non-color image. Skipping the feature.\n\n']);
0034     end
0035     idx = setdiff(idx,f);
0036   end
0037 end
0038 
0039 % actually remove the features and their weights
0040 params.features = params.features(idx);
0041 params.weights = params.weights(idx);

Generated on Thu 18-Jul-2013 06:10:46 by m2html © 2005