MATLAB Answers

0

Inverse dct in matlab

Stewart Tan 님이 질문을 제출함. 1 Sep 2019
최근 활동 R.G. 님이 답변함. 1 Sep 2019
So I want to remove the higher frequency dct from an image and reconstruct it, so i followed an example by Matlab https://www.mathworks.com/help/images/ref/dct2.html. However, when i tried with my own image, it didn't turn out to be great. I'm using an image:
Capture.PNG
and i followed every step in the link with:
img = imread('giraffe.png');
img = rgb2gray(img);
J = dct2(img);
figure
imshow(log(abs(J)),[])
colormap(gca,jet(64))
colorbar
The colorbar
Capture2.PNG
J(abs(J) < 10) = 0;
img_r = idct2(J);
imshow(img_r)
But my output image became:
Capture.PNG
Why did this happen?

  댓글 수: 0

로그인 to comment.

답변 수: 1

R.G. 님의 답변 1 Sep 2019
 채택된 답변

Hello! Just specify display range. Use imshow(img_r, [0 255]) instead.
I've checked it.
img = imread('giraffe.png');
img = rgb2gray(img);
J = dct2(img);
J(abs(J) < 100) = 0;
img_r = idct2(J);
imshow(img_r, [0 255])

  댓글 수: 0

로그인 to comment.



Translated by