资源简介
这个程序是基于压缩感知理论的图像重构算法,采用离散余弦变换将原始图像稀疏化,在采用高斯随机矩阵进行采样,最后使用MP算法、OMP算法、coamap算法等几种算法重构
代码片段和文件信息
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
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 428181 2010-07-23 10:17 CS_recovery_algorithms_OMP_SP_IHT\CS Recovery Algorithms.pdf
文件 3456 2010-07-16 14:45 CS_recovery_algorithms_OMP_SP_IHT\software\Demo_CS_CoSaMP.m
文件 8278 2010-07-15 10:02 CS_recovery_algorithms_OMP_SP_IHT\software\Demo_CS_GBP.m
文件 2904 2010-07-22 14:16 CS_recovery_algorithms_OMP_SP_IHT\software\Demo_CS_IHT.m
文件 2903 2010-07-15 10:02 CS_recovery_algorithms_OMP_SP_IHT\software\Demo_CS_IRLS.m
文件 3340 2010-07-16 14:47 CS_recovery_algorithms_OMP_SP_IHT\software\Demo_CS_OMP.m
文件 3434 2010-07-15 10:03 CS_recovery_algorithms_OMP_SP_IHT\software\Demo_CS_SP.m
文件 66614 2010-05-11 20:29 CS_recovery_algorithms_OMP_SP_IHT\software\lena.bmp
目录 0 2010-07-23 10:18 CS_recovery_algorithms_OMP_SP_IHT\software
目录 0 2010-07-23 10:18 CS_recovery_algorithms_OMP_SP_IHT
----------- --------- ---------- ----- ----
519110 10
- 上一篇:HEVC测试序列139681
- 下一篇:T接头AD封装库尺寸准确
相关资源
- 压缩感知代码-沙威
- 压缩感知算法
- 基于压缩感知BP,BPOMPStOMP二维图像比
- 矩阵填充中的SVT重构算法
- 深度学习:深度压缩感知-从ISTA到LI
- 小波omp,压缩感知程序
- 压缩感知做信道估计
- 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同伦算法
评论
共有 条评论