Inverse dct in matlab
1 回表示 (過去 30 日間)
古いコメントを表示
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/236559/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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/236560/Capture2.png)
J(abs(J) < 10) = 0;
img_r = idct2(J);
imshow(img_r)
But my output image became:
![Capture.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/236561/Capture.png)
Why did this happen?
0 件のコメント
採用された回答
R.G.
2019 年 9 月 1 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!