• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

获取图像频域并分解为高低频(MATLAB)

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

我们展示两种频域分解方案: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 square, colorbar
subplot(3,2,4), imagesc(log(abs(High_T))), title('log(DCT(HF))'), axis square, colorbar

subplot(3,2,5), imagesc(Low), title('LF'), axis square, colorbar
subplot(3,2,6), imagesc(High), title('HF'), axis square, colorbar

2. SWT变换

picture1=im2double(imread("output/0_QP22_o6.png"));
[gac,ghc,gvc,gdc]=dwt2(picture1,'haar');

%normalize
ghc_l1=ghc(:,:,:,1);  
pp=max(max(max(ghc_l1)));
ghc_l1=ghc_l1-pp;
qq=min(min(min(ghc_l1)));
ghc_l1=ghc_l1./qq;

gac_l1=gac(:,:,:,1);  
pp=max(max(max(gac_l1)));
gac_l1=gac_l1-pp;
qq=min(min(min(gac_l1)));
gac_l1=gac_l1./qq;

gvc_l1=gvc(:,:,:,1);  
pp=max(max(max(gvc_l1)));
gvc_l1=gvc_l1-pp;
qq=min(min(min(gvc_l1)));
gvc_l1=gvc_l1./qq;

gdc_l1=gdc(:,:,:,1);  
pp=max(max(max(gdc_l1)));
gdc_l1=gdc_l1-pp;
qq=min(min(min(gdc_l1)));
gdc_l1=gdc_l1./qq;


% mean(mean(ghc_l1+gvc_l1+gdc_l1))
figure()
histogram(ghc,[-0.15:0.002:0.15])
% set(gca,'YLim',[0 18000])
figure()
histogram(gvc,[-0.08:0.001:0.08])
% set(gca,'YLim',[0 30000])
figure()
histogram(gdc,[-0.06:0.001:0.06])

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Delphi中关于资源释放(Free/release/freeAndNil)的一点体会发布时间:2022-07-18
下一篇:
基于Matlab的剪切干涉仪仿真模拟发布时间:2022-07-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap