I'm building my own DCT compression code, and the resulting image is blurred and has visible blocks in it,something not present in the original image.
Here's the resulting image:
and here's the original image:
The code is as follows:
%Compression snippet
y = blockproc(x, [8,8], dct);
fun = @(block_struct) round(block_struct.data ./ m);
y = blockproc(y, [8,8], fun);
y = im2col(y, [8,8],'distinct');
% decompression snippet
x = col2im(z, [8 8], [xm xn], 'distinct');
fun = @(block_struct) (block_struct.data .* m);
y = blockproc(x, [8,8], fun);
size(y)
t = dctmtx(8);
dct = @(block_struct) t' * block_struct.data * t;
y = blockproc(y, [8,8], dct);
x = uint8(y + 128);
I didn't include all of the code.

답변 (1개)

Thorsten
Thorsten 2015년 10월 8일

0 개 추천

It seems that you have reduced the resolution of the image by 8.

댓글 수: 1

Siyomnqoba
Siyomnqoba 2015년 10월 8일
image size has gone up to still 775 by 775 I don't get how this has happened but when I use size(image) it still says the image size is 512 by 512 which is what it should be in the first place....what could've cause this change in resolution? I was supposed to embed a huffman encoder but I ran into problems with the decoder function decided to do it later,could this perhaps be the reason for this?that I didn't include the huffman encoder?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Import, Export, and Conversion에 대해 자세히 알아보기

질문:

2015년 10월 8일

댓글:

2015년 10월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by