function q = quantize(im, nlevels)
% uniform quantization using n levels

q = floor((im - min(min(im))) / (max(max(im))-min(min(im))+1) * nlevels);
