how matlab function dct2() is different from the the following 2-dct code

5 views (last 30 days)
i applied matlab function dct2() and the following code. both methods gives me different values. if you explain why? it will be helpful. thanks
T = dctmtx(8);
dct = @(block_struct) T * block_struct.data * T';
codeI1 = im2double(codeI); % coded image
B = blockproc(codeI1,[8 8],dct);
mask = [1 1 1 1 0 0 0 0
1 1 1 0 0 0 0 0
1 1 0 0 0 0 0 0
1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0];
B2 = blockproc(B,[8 8],@(block_struct) mask .* block_struct.data);
figure
imshow(B);
invdct = @(block_struct) T' * block_struct.data * T;
I2 = blockproc(B2,[8 8],invdct);
figure
imshow(I2);

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!