DCT
DCT
DCT
for convenience
Note that each entry is 8x8 matrix . In total, there are 64 base matrices
1
Let Then DCT of x is
16. For , Create DCT basis set vector (here it is 2D) , DCT_3_4
from 1D basis set for
(basis set matrix created by outer producting 3rd and 4th 1D basis set
vectors in order )
2
-0.080 0.019 0.094 0.053 -0.053 -0.094 -0.019 0.080
-0.192 0.045 0.227 0.128 -0.128 -0.227 -0.045 0.192
-0.192 0.045 0.227 0.128 -0.128 -0.227 -0.045 0.192
-0.080 0.019 0.094 0.053 -0.053 -0.094 -0.019 0.080
0.080 -0.019 -0.094 -0.053 0.053 0.094 0.019 -0.080
0.192 -0.045 -0.227 -0.128 0.128 0.227 0.045 -0.192
rng("default")
M=randi([0 255],8,8);
B=idct(eye(8)); b3=B(:,3); b4=B(:,4);
DCT_3_4=b3*b4';
Coef_3_4=dot( M(:), DCT_3_4(:) ); %Vectorise and
take dot product
disp(num2str(Coef_3_4,'%2.3f '))
-57.858
rng("default")
M=randi([0 255],8,8);
D=dct2(M);
disp(num2str(D,'%2.3f ')); % verify DCT_3_4
coefficient
3
19. Find all 2D DCT coefficients for M=magic(8). what you infer
rng("default")
M=magic(8);
D=dct2(M);
disp(num2str(D,'%2.3f '));
rng("default")
M=magic(8);
disp(num2str(M,'%2.0f '))
4
64 2 3 61 60 6 7 57
9 55 54 12 13 51 50 16
17 47 46 20 21 43 42 24
40 26 27 37 36 30 31 33
32 34 35 29 28 38 39 25
41 23 22 44 45 19 18 48
49 15 14 52 53 11 10 56
8 58 59 5 4 62 63 1
D=dct2(M);
threshold = 0.0001;
% Set values to zero if their absolute value is
less than the threshold
D(abs(D) < threshold) = 0;
% Display the modified matrix
disp(num2str(D,'%2.1f '));
D_r=idct2(D);
disp(num2str(D_r,'%2.0f '));
64 2 3 61 60 6 7 57
9 55 54 12 13 51 50 16
17 47 46 20 21 43 42 24
40 26 27 37 36 30 31 33
32 34 35 29 28 38 39 25
41 23 22 44 45 19 18 48
49 15 14 52 53 11 10 56
8 58 59 5 4 62 63 1
Projects
5
1. Image Compression
2. Watermarking
3. Steganography
4. Audio watermarking