0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 function [featureMaps,csLevels] = centerSurround(pyr,params)
0021
0022 debugMsg('',pyr);
0023
0024
0025 lp = params.levelParams;
0026 siz = size(pyr.levels(lp.mapLevel).data);
0027 numLevels = length(pyr.levels);
0028
0029
0030 exclusionIdx = [];
0031 if isfield(params,'exclusionMask')
0032 if ~isempty(params.exclusionMask)
0033 switch class(params.exclusionMask)
0034 case 'struct'
0035 exclusionIdx = (imresize(params.exclusionMask.data,siz,'nearest') ~= 0);
0036 case {'double','uint8'}
0037 exclusionIdx = (imresize(params.exclusionMask,siz,'nearest') ~= 0);
0038 case 'logical'
0039 exclusionIdx = imresize(params.exclusionMask,siz,'nearest');
0040 otherwise
0041 error(['Unknown class type for params.exclusionMask: ' class(params.exclusionMask)]);
0042 end
0043 end
0044 end
0045
0046
0047 c = 1;
0048 for l = lp.minLevel:(lp.maxLevel + lp.maxDelta)
0049 if (l > numLevels) break; end
0050 maps(c).origImage = pyr.levels(l).origImage;
0051 maps(c).label = pyr.levels(l).label;
0052 maps(c).data = imresize(pyr.levels(l).data,siz,'nearest');
0053 maps(c).data(exclusionIdx) = 0;
0054 maps(c).date = timeString;
0055 idx(l) = c;
0056 c = c + 1;
0057 end
0058
0059
0060 cc = 1;
0061 borderSize = round(max(siz)/20);
0062 lab = pyr.label;
0063 for l = lp.minLevel:lp.maxLevel;
0064 for d = lp.minDelta:lp.maxDelta
0065 l2 = l + d;
0066 if (l2 > numLevels) continue; end
0067 featureMaps(cc).origImage = maps(idx(l)).origImage;
0068 featureMaps(cc).label = sprintf('%s (%d-%d)',lab,l2,l);
0069 featureMaps(cc).data = attenuateBorders(abs(maps(idx(l)).data - maps(idx(l2)).data),...
0070 borderSize);
0071 csLevels(cc).centerLevel = l;
0072 csLevels(cc).surroundLevel = l2;
0073 featureMaps(cc).date = timeString;
0074 featureMaps(cc).parameters = params;
0075 cc = cc + 1;
0076 end
0077 end