function q = imagequant(x, w1, w2, w3) %imagequant quantizes the pixel values of a tri-chromatic image % Usage q = imagequant(x, w1, w2, w3), where: % Inputs % - x is the input image who's values are going to be quantized % - w1 is the quantization step size for the first channel (red) % - w2 is the quantization step size for the second channel (green) % - w3 is the quantization step size for the third channel (blue) % % Output % - q is the image with the quantized values q = struct; q.red = myquant(x.red, w1); q.green = myquant(x.green, w2); q.blue = myquant(x.blue, w3); end