function [chist] = colrHist(im,nbins,minV,maxV,winx,winy)
%
%  [chist] = colrHist(im,nbins,minV,maxV,winx,winy)
%
  
  bsz = (maxV-minV)/nbins;
  
  chist = zeros(size(im,1),size(im,2),nbins*size(im,3));
  k=1;
  %  smsk = ones(winy,winx);
  smskx = ones(1,winx);
  smsky = ones(winy,1);
  for j=1:size(im,3)
    bmin = minV;
    for i=0:(nbins-1)
      bmax = minV+(i+1)*bsz;
      if i==(nbins-1)
	bmax = bmax + 1e-6;
      end
      c = im(:,:,j)>= bmin & im(:,:,j)< bmax;
      chist(:,:,k) = conv2(smsky,smskx,double(c),'same');
      %    chist(:,:,k) = winSum(uint8(c),winx,winy);
      k=k+1;
      bmin=bmax;
    end % for bins (i)
  end % for  channels (j)
  
  