获取图像频域并分解为高低频(MATLAB)
我们展示两种频域分解方案:DCT或SWT变换。代码需要适配。
1. DCT变换
%// Load an image
Orig = im2double((imread("output_HEVC/1_QP22_" + tab(i) + ".png")));
%Orig = rgb2gray(Orig);
%// Transform
Orig_T = dct2(Orig);
%// Split between high- and low-frequency in the spectrum (*)
cutoff = round(0.5 * 256);
High_T = fliplr(tril(fliplr(Orig_T), cutoff));
Low_T = Orig_T - High_T;
%// Transform back
High = idct2(High_T);
Low = idct2(Low_T);
%// Plot results
figure, colormap gray
subplot(3,2,1), imagesc(Orig), title('Original'), axis square, colorbar
subplot(3,2,2), imagesc(log(abs(Orig_T))), title('log(DCT(Original))'), axis square, colorbar
subplot(3,2,3), imagesc(log(abs(Low_T))), title('log(DCT(LF))'), axis sq