1
$\begingroup$

Suppose we have a 2x2 image as follows:

enter image description here

What does each dequantised image look like after it has first been quantised to 7, 4 and 2 bits respectively?

I solve this question by initially quantising as follows.

  1. Into 7 bits : 8 bits - 7 bits = 1 bit and 2 to the power of 1 is 2 so, 232 / 2 = 116, 127 / 2 = 63, 169 / 2 = 84 and 27 / 2 = 13. Therefore, we have:

enter image description here

  1. Into 4 bits: 8 bits - 4 bits = 4 bits and 2 to the power of 4 equals 16. Thus, 232/16 = 14, 127 / 16 = 7, 169 / 16 = 10, 27 / 16 = 1.

enter image description here

  1. Into 2 bits: 8 bits - 2 bits = 6 bits and 2 to the power of 6 is 128 so, 232 / 128 = 1, 127 / 128 = 0, 169 / 128 = 1 and 27 / 128 = 0 hence, we have:

enter image description here

Now, to dequantise the results we simply multiply each cell value by the number we initially used for quantisation. The above matrices will be as follows respectively:

enter image description here enter image description here enter image description here

Are all steps in my solution correct, if not where should be modified?

EDIT

According to what @Hilmar detected, 2 to the power of 6 is 64 and the quantisation into 2 bits should be changed to: 232 / 64 = 3, 127 / 64 = 1, 169 / 64 = 2 and 27 / 64 = 0 hence, we have:

enter image description here

$\endgroup$
0
$\begingroup$

There are a couple of ways to "quantize/dequantize" integer data. This should be specified to avoid different results. You have used the version:

$$ I_Q = \Delta\left\lfloor I/\Delta \right\rfloor $$

with $\Delta = 2^{8-b}$ ($b$ is the intermediate bit number) and your results seem fine with that choice. One other possible choice (better preserving bright tones) is: $$ I_Q = \Delta\left\lceil (I+1)/\Delta \right\rceil -1 $$

Some others preserve the range, etc.

Don't hesitate to clearly state your quantization scheme, as it will be more precise than the inexact computation of rounding 127 / 128 = 0.

Here is a small Matlab code to recover the results:

B = 8; % Original bit-depth
bList = [7,4,2]; % quantized bit-depth
I = [232,127;169,27];
for b = bList
   Iq = 2^(8-b)*floor(I/2^(8-b)); % Quantized/Dequantized image
   disp(Iq)
end

giving the arrays:

$$ \begin{array}{rr} 232 & 126\\ 168 & 26 \end{array} $$

$$ \begin{array}{rr} 224 & 112\\ 160 & 16 \end{array} $$

$$ \begin{array}{rr} 192 & 64\\ 128 & 0 \end{array} $$

$\endgroup$
3
  • $\begingroup$ Thank you. Apart from the quantization scheme, is the de-quantisatiopn process correct? $\endgroup$
    – plpm
    Jun 5 at 23:23
  • $\begingroup$ I have added some details, ok for 8-bit depth and the basic quantization $\endgroup$ Jun 6 at 20:12
  • 1
    $\begingroup$ Thank you very much. $\endgroup$
    – plpm
    Jun 7 at 17:56
0
$\begingroup$

Are all steps in my solution correct,

No. Your 2 bit quantizer is clearly wrong. $2^6 = 64$ and not 128.

if not where should be modified?

As Laurent Duval has pointed out, that depends a lot on the specific choice of your quantizer. What are your quantization steps, do you round or truncate, how do manage "out of bound" conditions, etc.

$\endgroup$
2
  • $\begingroup$ Thank you. You are right. I edit the question. How about the de-quantisation, is it correct? $\endgroup$
    – plpm
    Jun 5 at 23:25
  • 1
    $\begingroup$ We cannot answer this until you define your quantization and de-quantization process. There is more than one "correct" answer. $\endgroup$
    – Hilmar
    Jun 6 at 23:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.