主要内容:

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. 修改navigationbar右侧按钮离屏幕边缘位置

    先上代码 UIButton *settingBtn = [Utils creatCustomButtonWithFrame:CGRectMake(, , , ) btnTitle: titleColo ...

  2. 网页中的JavaScript

    变量的声明和赋值 var count;定义变量 count = 5;赋值 var” - 用于声明变量的关键字 “count” - 变量名 同时声明和赋值变量 var count = 10; 声明多个变 ...

  3. php 图片处理类

    <?php /** * 图片类 * @author <420012223@qq.cn> */ class Image { public $uploadImagePath = './t ...

  4. 发布一个UDP调试助手

    UDP协议适用于那种频繁通信,但是可以容忍一些丢包的应用,比如GPS的定位应用. 调试UDP助手,可以定时发送,输出文本, 记录收到时间. 1. 该工具基于IOCP网络模型,调试UDP服务使用的一个工 ...

  5. mybatis 关联查询 association

    <resultMap id="DutyPersonAndFileAndScoreMap" type="com.cares.asis.duty.entity.Duty ...

  6. 20145225 《Java程序设计》第2周学习总结

    20145225<Java程序设计> 第2周学习总结 教材学习内容总结 3.1.1Java的类型 分为基本类型(Primitive type)和类类型(Class type) 基本类型: ...

  7. PostScript的简单例子-用粗线画一个圆

    一 近期需要用到PostScript,查询资料学习PS的语法 简单的画一个圆的例子 %!PS-Adobe-3.0 /inch{72 mul} def 4.25 inch 5.5 inch 1.5 in ...

  8. 多线程JAVA篇(一)

    解析AsyncTask源码之前,首先讲述与之相关的Java线程知识: 知识点清单 1.Thread类 2.Runnable接口 3.Callable接口 4.synchronized关键字 5.vol ...

  9. 自己写ORM框架 SqlHelper_DG C#(java的写在链接里)

    ORM框架想必大家都比较熟知了,即对象关系映射(英语:Object Relation Mapping,简称ORM,或O/RM,或O/R mapping),是一种程序技术,用于实现面向对象编程语言里不同 ...

  10. android中 EditTex t的 inputType 属性

    //文本类型,多为大写.小写和数字符号    android:inputType="none"    android:inputType="text"    a ...