Applying Quantization Matrix in which specific coefficients are zero'd out

4 views (last 30 days)
Hello,
I'm trying to quantize 8x8 blocks using an 8x8 sample quantization matrix that I found online for image processing.
The only issue is that I want to be able to pick and choose which coefficients that I keep during quantization.
For instance if i want to zero out the circle'd portion of the matrix, how would I go about modifying my Quantization Matrix?
Sample Quantization Matrix and implementation:
Q_Matrix= [16 11 10 16 26 40 51 61
12 12 14 19 26 58 60 55
14 13 16 24 40 57 69 56
14 17 22 29 51 87 80 62
18 22 37 56 68 109 103 77
24 35 55 64 81 104 113 92
49 64 78 87 103 121 120 101
72 97 95 98 112 100 103 99];
Quantized_Matrix = floor(blocks_dct ./ Q_Matrix);
DeQuantized_Matrix = Quantized_Matrix .* Q_Matrix;
  2 Comments
Image Analyst
Image Analyst on 28 Apr 2023
You can't have matrices with "ragged" rows or columns, so what does "get rid of" mean to you? Do you mean to set their values to zero?

Sign in to comment.

Accepted Answer

Matt J
Matt J on 28 Apr 2023
Edited: Matt J on 28 Apr 2023
One way would be to set Q_matrix to twice the maximum of blocks_dct. That will ensure that the floor() operation zeros them.
Another way would be to apply a binary mask to zero_out the blocks_dct ellements appropriately,
Quantized_Matrix = floor( (blocks_dct.*Mask) ./ Q_Matrix);

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!