function [k1, k2, k3] = separableFilters(sampPerDeg, dimension) % % [k1, k2, k3] = separableFilters(sampPerDeg, dimension) % % Create the pattern-color separable filters according to % the Poirson & Wandell 1993 fitted spatial response. The filters % are each weighted sum of 2 or 3 gaussians. % % sampPerDeg -- filter resolution in samples per degree of visual angle. % % dimension -- specifies whether the created filters should be 1-D or 2-D. % % dimension = 1: generate the linespread of the filters; % This is useful for 1-d image calculations, say for theoretical % work. % % dimension = 2: generate the pointspread of the filters; % This is useful if you just want to create an image of the filters % % dimension = 3: generate the pointspread in the form that can be used by % separableConv. The result is a set of 1-d filters that can be applied % to the rows and cols of the image (separably). % % Functions called: sumGauss. % % Xuemei Zhang 1/28/96 % Last Modified 2/29/95 if (nargin==1) dimension = 1; end minSAMPPERDEG = 224; % if sampPerDeg is smaller than minSAMPPERDEG, need to upsample image data before % doing the filtering. This can be done equivalently by convolving % the filters with the upsampling matrix, then downsample it. if ((sampPerDeg1 ) upcol = [1:uprate (uprate-1):(-1):1]/uprate; s = length(upcol); upcol = resize(upcol, [1 s+width-1]); up1 = conv2(k1, upcol, 'same'); up2 = conv2(k2, upcol, 'same'); up3 = conv2(k3, upcol, 'same'); s = size(up1, 2); mid = ceil(s/2); downs = [fliplr([mid:(-uprate):1]) (mid+uprate):uprate:size(up1,2)]; k1 = up1(:, downs); k2 = up2(:, downs); k3 = up3(:, downs); end