资源简介
小波omp,压缩感知程序,用于压缩感知的认识,对初学者和很有用
代码片段和文件信息
function Demo_CS_CoSaMP()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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: D. Deedell andJ. Tropp “COSAMP: Iterative Signal Recovery from
% Incomplete and Inaccurate Samples” 2008.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%------------ read in the image --------------
img=imread(‘lena.bmp‘); % testing image
img=double(img);
[heightwidth]=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.^21))[floor(height/3)1]); % normalize each column
mat_dct_1d=zeros(256256); % 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 omp ------------
sparse_rec_1d=zeros(heightwidth);
Theta_1d=Phi*mat_dct_1d;
for i=1:width
column_rec=cs_cosamp(img_cs_1d(:i)Theta_1dheight);
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(221)imagesc(img)title(‘original image‘)
subplot(222)imagesc(Phi)title(‘measurement mat‘)
subplot(223)imagesc(mat_dct_1d)title(‘1d dct mat‘)
psnr = 20*log10(255/sqrt(mean((img(:)-img_rec_1d(:)).^2)))
subplot(224)imagesc(img_rec_1d)title(strcat(‘1d rec img ‘num2str(psnr)‘dB‘))
disp(‘over‘)
%************************************************************************%
function hat_x=cs_cosamp(yT_Matm)
% y=T_Mat*x T_Mat is n-by-m
% y - measurements
% T_Mat - combination of random matrix and sparse representation basis
% m - size of the original signal
% the sparsity is length(y)/4
n=length(y); % length of measurements
s=floor(n/4); % sparsity
r_n=y; % initial residuals
sig_pos_lt=[]; % significant pos for last time iteration
for times=1:s % number of iterations
product=abs(T_Mat‘*r_n);
[valpos]=sort(product‘descend‘);
sig_pos_cr=pos(1:2*s); % significant pos for curretn iteration
sig_pos=union(sig_pos_crsig_pos_lt);
Aug_t=T_Mat(:sig_pos); % current selected entries
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3456 2010-07-16 14:45 Wavelet_OMP\Demo_CS_CoSaMP.m
文件 1065 2009-10-14 18:27 Wavelet_OMP\DWT.m
文件 66614 2009-06-08 18:00 Wavelet_OMP\lena256.bmp
文件 2499 2009-10-14 18:13 Wavelet_OMP\Wavelet_OMP.m
目录 0 2016-01-24 18:19 Wavelet_OMP
----------- --------- ---------- ----- ----
73634 5
- 上一篇:f28335最小系统原理图
- 下一篇:dxp单片机元件库
相关资源
- 压缩感知做信道估计
- DMD驱动板设计/FPGA
- 压缩感知demo
- 基于压缩感知的MIMO信道估计算法
- 分块压缩感知模型
- 4_11_基于压缩感知理论的DOA估计.zip
- 压缩感知-CS-BP算法基追踪算法
- 压缩感知之TVAL3算法
- 二维压缩感知在图像压缩中的对比B
- Compressed Sensing: Theory and Applications(压
- 压缩感知,原作者写的SL0算法
- 六种压缩感知算法实现
- 压缩感知中构造测量矩阵研究
- 压缩感知BP算法
- 多个L1范数算法,学习压缩感知初步了
- 压缩感知CS(附多种算法)
- 压缩感知的SP算法
- 基于Robust-L1 的相位恢复
- 压缩感知程序代码
- 基于压缩感知的图像重构
- 基于HEED和压缩感知的无线传感器网络
- 压缩感知/压缩传感图像重建算法
- 语音信号分帧压缩感知
- 压缩感知和稀疏恢复中的L1同伦算法
评论
共有 条评论