初识贝叶斯压缩感知

在这里插入图片描述

1.贝叶斯压缩感知

设一个原始信号XX的重构问题就可以利用贝叶斯理论进行求解了。

2. 简单代码demo

要运行下面这段代码,还必须去这个网站
http://people.ee.duke.edu/~lcarin/BCS.html
上面下载 bcs_ver0.1.zip 这个代码包。复制里面的BCS_fast_rvm.m文件和下面这段代码放在同一个workspace下面就可以了。另外需要下载lena.bmp这张256*256大小的测试图片。

%------------------------------------------------------
% This code generates Figure 2 of the following paper: 
% "Bayesian Compressive Sensing" (Preprint, 2007)
% This example is modified from l1qc_example.m, an example 
% from l1magic.
% Coded by: Shihao Ji, ECE, Duke University
% last change: Jan. 2, 2007
%------------------------------------------------------
clear all
addpath('BCSdemo');
img=imread('lena.bmp');     % read in the image "lena.bmp"
img=double(img);
[height,width]=size(img);
img_rec=zeros(height,width);
N=height; % signal length
K = 150; % number of CS measurements

% projection matrix
phi= randn(K,N);
phi = phi./repmat(sqrt(sum(phi.^2,2)),[1,N]);   
% noisy observations
sigma = 0.0001;
e = sigma*randn(K,1);

%DCT基
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

Theta_1d=phi*mat_dct_1d;%测量矩阵乘上基矩阵

for i=1:width
%利用BCS重建
x=img(:,i);
y =phi*x + e;
initsigma2 = std(y)^2/1e2;% std(y):Standard deviation
[weights,used,sigma2,errbars] = BCS_fast_rvm(Theta_1d,y,initsigma2,1e-8);
x_BCS = zeros(N,1); err = zeros(N,1);
x_BCS(used) = weights; err(used) = errbars;
img_rec(:,i)=x_BCS';         
end
img_rec=mat_dct_1d*img_rec;           % inverse transform 稀疏系数乘上
figure
subplot(1,2,1),imshow(uint8(img)),title('original image')
subplot(1,2,2),imshow(uint8(img_rec)),title('rec image')
3. 结果

这里写图片描述
.

    Shihao Ji http://people.ee.duke.edu/~shji/ 杜克大学的博士,本科和硕士在西电读的,他以第一作者发了两篇PAMI。 作者目前主要在研究Bayesian Compressive Sensing. 相关的有三篇文章: 1。Bayesian compressive sensing and projection optimization。2007. [pdf file] 2。Bayesian compressive sensing。2008. 3。Multi-task compressive sensing。2009. 另外,从作者的主页可以链接到Bayesian Compressive Sensing 的主页,有很多相关的工作,及代码,感兴趣的可以查看:http://people.ee.duke.edu/~lihan/cs/
    • 2
      点赞
    • 18
      收藏
      觉得还不错? 一键收藏
    • 0
      评论
    评论
    添加红包

    请填写红包祝福语或标题

    红包个数最小为10个

    红包金额最低5元

    当前余额3.43前往充值 >
    需支付:10.00
    成就一亿技术人!
    领取后你会自动成为博主和红包主的粉丝 规则
    hope_wisdom
    发出的红包
    实付
    使用余额支付
    点击重新获取
    扫码支付
    钱包余额 0

    抵扣说明:

    1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
    2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

    余额充值