浅谈压缩感知(二十九):压缩感知算法之迭代硬阈值(IHT)
主要内容:
1、IHT的算法流程
2、IHT的MATLAB实现
3、二维信号的实验与结果
4、加速的IHT算法实验与结果
一、IHT的算法流程
文献:T. Blumensath and M. Davies, "Iterative Hard Thresholding for Compressed Sensing," 2008.
基本思想:给定一个初始的X0,然后通过以下的阈值公式不断地迭代。
二、IHT的MATLAB实现
function hat_x=cs_iht(y,T_Mat,s_ratio,m) % y=T_Mat*x, T_Mat is n-by-m % y - measurements % T_Mat - combination of random matrix and sparse representation basis % s_ratio - sparsity percentage of original signal % m - size of the original signal % the sparsity is length(y)/4hat_x_tp=zeros(m,1); % initialization with the size of original s=floor(length(y)*s_ratio); % sparsity u=0.5; % impact factor% T_Mat=T_Mat/sqrt(sum(sum(T_Mat.^2))); % normalizae the whole matrixfor times=1:sx_increase=T_Mat'*(y-T_Mat*hat_x_tp); hat_x=hat_x_tp+u*x_increase;[val,pos]=sort(abs(hat_x),'descend'); hat_x(pos(s+1:end))=0; % thresholding, keeping the larges s elementshat_x_tp=hat_x; % updateend
三、二维信号的实验与结果
function Demo_CS_IHT()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% the DCT basis is selected as the sparse representation dictionary
% instead of seting the whole image as a vector, I process the image in the
% fashion of column-by-column, so as to reduce the complexity.% Author: Chengfu Huo, roy@mail.ustc.edu.cn, http://home.ustc.edu.cn/~roy
% Reference: T. Blumensath and M. Davies, “Iterative Hard Thresholding for
% Compressed Sensing,” 2008.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%------------ read in the image --------------
img=imread('lena.bmp'); % testing image
img=double(img);
[height,width]=size(img);%------------ form the measurement matrix and base matrix ---------------
Phi=randn(floor(height/3),width); % only keep one third of the original data
Phi = Phi./repmat(sqrt(sum(Phi.^2,1)),[floor(height/3),1]); % normalize each columnmat_dct_1d=zeros(256,256); % building the DCT basis (corresponding to each column)
for k=0:1:255 dct_1d=cos([0:1:255]'*k*pi/256);if k>0dct_1d=dct_1d-mean(dct_1d); end;mat_dct_1d(:,k+1)=dct_1d/norm(dct_1d);
end%--------- projection ---------
img_cs_1d=Phi*img; % treat each column as a independent signal%-------- recover using iht ------------
sparse_rec_1d=zeros(height,width);
Theta_1d=Phi*mat_dct_1d;
s_ratio = 0.2;
for i=1:widthcolumn_rec=cs_iht(img_cs_1d(:,i),Theta_1d,s_ratio,height);sparse_rec_1d(:,i)=column_rec'; % sparse representation
end
img_rec_1d=mat_dct_1d*sparse_rec_1d; % inverse transform%------------ show the results --------------------
figure(1)
% subplot(2,2,1),imagesc(img),title('original image')
subplot(2,2,1),imshow(img,[]),title('original image')
subplot(2,2,2),imagesc(Phi),title('measurement mat')
subplot(2,2,3),imagesc(mat_dct_1d),title('1d dct mat')
psnr = 20*log10(255/sqrt(mean((img(:)-img_rec_1d(:)).^2)));
% subplot(2,2,4),imagesc(img_rec_1d),title(strcat('1d rec img ',num2str(psnr),'dB'))
subplot(2,2,4),imshow(img_rec_1d,[]),title(strcat('1d rec img ',num2str(psnr),'dB'))disp('over')%************************************************************************%
function hat_x=cs_iht(y,T_Mat,s_ratio,m)
% y=T_Mat*x, T_Mat is n-by-m
% y - measurements
% T_Mat - combination of random matrix and sparse representation basis
% s_ratio - sparsity percentage of original signal
% m - size of the original signal
% the sparsity is length(y)/4hat_x_tp=zeros(m,1); % initialization with the size of original
s=floor(length(y)*s_ratio); % sparsity
u=0.5; % impact factor% T_Mat=T_Mat/sqrt(sum(sum(T_Mat.^2))); % normalizae the whole matrixfor times=1:sx_increase=T_Mat'*(y-T_Mat*hat_x_tp);hat_x=hat_x_tp+u*x_increase;[val,pos]=sort(abs(hat_x),'descend'); hat_x(pos(s+1:end))=0; % thresholding, keeping the larges s elementshat_x_tp=hat_x; % updateend
结论:实验针对的是图像信号,但算法中运用的是1维的算法,因此实验结果不太理想。(后面提供一个链接,有更好的代码 hard_l0_Mterm.m)
四、加速的IHT算法实验与结果
文献:Blumensath T. Accelerated iterative hard thresholding[J]. Signal Processing, 2012, 92(3): 752-756.
五、相关代码
http://www.personal.soton.ac.uk/tb1m08/sparsify/sparsify.html
转载于:https://www.cnblogs.com/AndyJee/p/5151312.html
浅谈压缩感知(二十九):压缩感知算法之迭代硬阈值(IHT)相关推荐
- 压缩感知重构算法之迭代硬阈值(IHT)
题目:压缩感知重构算法之迭代硬阈值(Iterative Hard Thresholding,IHT) 本篇来介绍IHT重构算法.一般在压缩感知参考文献中,提到IHT时一般引用的都是文献[1],但IHT ...
- 压缩感知重构算法之迭代硬阈值(Iterative Hard Thresholding,IHT)
转载自:https://blog.csdn.net/wyw921027/article/details/52102211 题目:压缩感知重构算法之迭代硬阈值(Iterative Hard Thresh ...
- 压缩感知重构算法之迭代软阈值(IST)
题目:压缩感知重构算法之迭代软阈值(IST) 看懂本篇需要有以下两篇作为基础: (1)软阈值(Soft Thresholding)函数解读 (2)Majorization-Minimization优化 ...
- 动画骨骼【Visual C++】游戏开发五十二 浅墨DirectX教程二十 骨骼动画来袭(一)...
间时紧张,先记一笔,后续优化与完善. 本系列文章由zhmxy555(毛星云)编写,载转请注明出处. 文章链接: http://blog.csdn.net/zhmxy555/article/detail ...
- 曾国藩谕纪鸿(咸丰六年九月二十九夜)- 勤俭自持,习劳习苦
字谕纪鸿儿: 家中人来营者,多称尔举止大方,余为少慰.凡人多望子孙为大官,余不愿为大官,但愿为读书明理之君子.勤俭自持,习劳习苦,可以处乐,可以处约.此君子也.余服官二十年,不敢稍染官 ...
- 妙!二十九招驱蚊止痒不再愁
天气热了,蚊子也多了,让人烦不胜烦,如何才可解决蚊子带来的困扰,现整理了二十九个妙法,解决蚊子不在愁! 1.在家庭中可用浓肥皂涂抹可迅速止痒,或用香皂蘸水在红肿处涂抹. 原因是肥皂高级脂肪酸的钠盐.如 ...
- 2021年大数据Hadoop(二十九):关于YARN常用参数设置
全网最详细的Hadoop文章系列,强烈建议收藏加关注! 后面更新文章都会列出历史文章目录,帮助大家回顾知识重点. 目录 本系列历史文章 前言 关于yarn常用参数设置 设置container分配最小内 ...
- catia三维轴承_浅谈基于CATIA二次开发的单排四点接触球轴承三维设计论文
浅谈基于CATIA二次开发的单排四点接触球轴承三维设计论文 一.概述 单排四点接触球转盘轴承是一种能够同时承受较大轴向负荷.径向负荷和倾覆力矩等综合载荷,集支承.旋转.传动.固定等多种功能于一身的特殊 ...
- 【黑金原创教程】【FPGA那些事儿-驱动篇I 】实验二十九:LCD模块
实验二十九:LCD模块 据说Alinx 301支持 7"TFT,好奇的朋友一定疑惑道,它们3.2"TFT以及7"TFT等两者之间究竟有何区别呢?答案很简单,前者自带控制器 ...
- Bootstrap入门(二十九)JS插件6:弹出框
Bootstrap入门(二十九)JS插件6:弹出框 加入小覆盖的内容,像在iPad上,用于存放非主要信息 弹出框是依赖于工具提示插件的,那它也和工具提示是一样的,是需要初始化才能够使用的 首先我们引入 ...
最新文章
- 理解和配置 Linux 下的 OOM Killer
- 软件测试风险评估分析
- CTF web题总结--unserizable
- 使用OpenCV与百度OCR C++ SDK实现文字识别
- 启明云端分享| 采用 B to B设计的RK3399核心板来了,邮票孔,支持4K、H.265 硬解码;核心板内置 EDP、MIPI-DSI、HDMI、DP 显示接口,带有 2 路 MIPI-CSI
- 函数调用方式__stdecl _stdcall _fastcall __thiscall介绍
- Excel 转为 MySQL 语句
- python字典的值可以是字典吗_python字典的值可以是字典吗
- c语言讲输入退回缓冲区_开始之前的结束-如何不退回输入错误的用户电子邮件...
- 打造 Microsoft Windows Server 2008 R2 SP1 支持的 Dell 桌面虚拟化解决方案
- 绘制几何图形——使用android.graphics类 onDraw
- 求助:字符的显示问题
- idea导入java项目步骤_idea导入javaweb项目
- Django 3实战: 仿链家二手房信息查询网(附GitHub源码) - 文末有送书活动啦!
- python用什么编译器-python用什么编译器
- WinForm 无边框窗体四周阴影 窗体可拖动 无边框自定义标题栏
- 繁体字转换 java_java代码实现简体繁体转换
- 详解pandas的read_csv方法
- 2.2 字 母 表 和 符 号 串 的 基 本 概 念
- JS原生:XMLHttpRequest发送GETPOST请求
热门文章
- pandas统计所有列的基础数据
- pymysql操作数据库
- 如何用yolov5测试图片
- 【论文笔记】Deep Learning Face Representation from Predicting 10,000 Classes
- python数字图像处理(9):直方图与均衡化
- 分类算法学习(四)——决策树算法的原理及简单实现
- pandas 数据结构与基础功能
- Open3D+vs配置以及使用教程
- python面向对象的编程_不会面向对象,肯定学不好Python!简易的面向对象攻略来啦...
- 主板电源开关接口图解_主板跳线接法示意图,超详细适合DIY新手