function y = tileImg(f, winSize)

sze = size(f);
depth = sze(3);
sze = sze(1);


boxFilter = (1/winSize^2)*(ones(winSize, winSize));

for k = 1:(sze/winSize)
   for j = 1:(sze/winSize)
      for l = 1:depth
      	temp = f(:,((j-1)*winSize+1):(j*winSize),l);
      	temp = temp(((k-1)*winSize+1):(k*winSize),:);
      	temp = temp.*boxFilter;
         tempImg(k,j,l) = sum(sum(temp));
      end
   end
end

y = tempImg;