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

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 件のコメント

Image Analyst
Image Analyst 2023 年 4 月 28 日
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?
KG573
KG573 2023 年 4 月 28 日
Yes, to set their values to zero.

サインインしてコメントする。

 採用された回答

Matt J
Matt J 2023 年 4 月 28 日
編集済み: Matt J 2023 年 4 月 28 日
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);

その他の回答 (0 件)

カテゴリ

質問済み:

2023 年 4 月 28 日

編集済み:

2023 年 4 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by