主要内容:

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)/ hat_x_tp=zeros(m,); % 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.^))); % normalizae the whole matrix for times=:s x_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+:end))=; % thresholding, keeping the larges s elements hat_x_tp=hat_x; % update end

三、二维信号的实验与结果

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 column mat_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>0
dct_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:width
column_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)/4 hat_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 matrix for times=1:s x_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 elements hat_x_tp=hat_x; % update end

结论:实验针对的是图像信号,但算法中运用的是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

浅谈压缩感知(二十九):压缩感知算法之迭代硬阈值(IHT)的更多相关文章

  1. Bootstrap <基础二十九>面板(Panels)

    Bootstrap 面板(Panels).面板组件用于把 DOM 组件插入到一个盒子中.创建一个基本的面板,只需要向 <div> 元素添加 class .panel 和 class .pa ...

  2. Web 开发人员和设计师必读文章推荐【系列二十九】

    <Web 前端开发精华文章推荐>2014年第8期(总第29期)和大家见面了.梦想天空博客关注 前端开发 技术,分享各类能够提升网站用户体验的优秀 jQuery 插件,展示前沿的 HTML5 ...

  3. WCF技术剖析之二十九:换种不同的方式调用WCF服务[提供源代码下载]

    原文:WCF技术剖析之二十九:换种不同的方式调用WCF服务[提供源代码下载] 我们有两种典型的WCF调用方式:通过SvcUtil.exe(或者添加Web引用)导入发布的服务元数据生成服务代理相关的代码 ...

  4. VMwarevSphere 服务器虚拟化之二十九 桌面虚拟化之安装View副本服务器

    VMwarevSphere 服务器虚拟化之二十九  桌面虚拟化之安装View副本服务器 VMware View中高可用性可是一个必须要考虑的问题.在整个虚拟桌面环境中View Connection S ...

  5. Bootstrap入门(二十九)JS插件6:弹出框

    Bootstrap入门(二十九)JS插件6:弹出框 加入小覆盖的内容,像在iPad上,用于存放非主要信息 弹出框是依赖于工具提示插件的,那它也和工具提示是一样的,是需要初始化才能够使用的 首先我们引入 ...

  6. mysql进阶(二十九)常用函数

    mysql进阶(二十九)常用函数 一.数学函数 ABS(x) 返回x的绝对值 BIN(x) 返回x的二进制(OCT返回八进制,HEX返回十六进制) CEILING(x) 返回大于x的最小整数值 EXP ...

  7. JAVA之旅(二十九)——文件递归,File结束练习,Properties,Properties存取配置文件,load,Properties的小练习

    JAVA之旅(二十九)--文件递归,File结束练习,Properties,Properties存取配置文件,load,Properties的小练习 我们继续学习File 一.文件递归 我们可以来实现 ...

  8. 浅谈Kotlin(二):基本类型、基本语法、代码风格

    浅谈Kotlin(一):简介及Android Studio中配置 浅谈Kotlin(二):基本类型.基本语法.代码风格 浅谈Kotlin(三):类 浅谈Kotlin(四):控制流 通过上面的文章,在A ...

  9. 【黑金原创教程】【FPGA那些事儿-驱动篇I 】原创教程连载导读【连载完成,共二十九章】

    前言: 无数昼夜的来回轮替以后,这本<驱动篇I>终于编辑完毕了,笔者真的感动到连鼻涕也流下来.所谓驱动就是认识硬件,还有前期建模.虽然<驱动篇I>的硬件都是我们熟悉的老友记,例 ...

随机推荐

  1. WordPress主机

  2. [html]选项卡效果

    晨间新闻 午间新闻 晚间新闻 视频新闻 <!doctype html> <html> <head> <meta charset="UTF-8&quo ...

  3. oracle创建用户、授予权限及删除用户

    创建用户   oracle对表空间 USERS 无权限 alter user 用户名 quota unlimited on users;   //创建临时表空间 create temporary ta ...

  4. mongodb:短网址项目

    短网址项目概述 1.短网址项目,是将给定的长网址,转换成短网址. 如 新浪 http://t.cn/zQd5NPw ,其中zQd5NPw就是短网址 前段页面如下

  5. POSIX信号处理

    信号用于通知进程发生了某件事情,可以由一个进程发给另一个进程,也可以由内核发个一个进程. 每个信号都有一个关联的行为,可以通过sigaction函数来设置一个信号的行为,有3种选择: 1.定义一个信号 ...

  6. android中的MVP模式

    1.建立bean public class UserBean { private String mFirstName; private String mLastName; public UserBea ...

  7. php 解析 视频 信息 封面 标题 图片 支持 优酷, 土豆 酷6 56 新浪 qq播客 乐视 乐视

    原文地址:http://www.lianyue.org/2013/2497/ <?php /** * 解析 视频信息 类 * * 支持 优酷, 土豆 酷6 56 新浪 qq播客 乐视 乐视 ** ...

  8. 第一章 git指令与设置

    相关指令: 1.从远程的master分支上创建新的分支,此时新分支内容与master分支内容相同: git checkout master; git branch newbranch; git che ...

  9. DIV布局-高度不同DIV,自动换行并对齐

    最近弄了一个动态添加div框,每个div框内容有多有少,要支持div高度自适应,还要添加的div自动追加,并且换行还要保持每行对齐. 刚开始的效果: 要改啊,搞不定,问了UI高手,终于给出了完美解决方 ...

  10. MySQL下划线特殊字符(Like 语句)

    最近用了MySQL+ibatis 做项目 问题描述: 在SQL里 用到了 a.name like ##%searchName%## searchName=test_1 发现出来的结果: test_1, ...