资源简介
Code demo for single-pixel imaging (SPI) with different reconstruction methods including
[1] differential ghost imaging (DGI)
[2] gradient descent (GD)
[3] conjugate gradient descent (CGD)
[4] Poisson maximum likelihood (Poisson)
[5] alternating projection (AP)
[6] sparse representation compressive sensing (Sparse)
[7] total variation compressive sensing (TV)
代码片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% By Liheng Bian June 22 2017. Contact me: lihengbian@gmail.com.
% This demo does the simulation of single-pixel imaging with different reconstruction methods.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear;
clc;
close all;
addpath(genpath(pwd));
%% Parameters
num_pixel = 64; % number of image pixels in each dimension
samplingRatio = 0.5;
para.tol = 1e-2;
para.min_iter = 30;
para.x0flag = 0; % initialization flag of the reconstructed image 0: all one; 1: pinv(A)*b.
%% Measurements
im = im2double(imread(‘cameraman.tif‘));
im = imresize(im[num_pixelnum_pixel]);
figureimshow(im[]‘InitialMagnification‘1000); title(‘Scene image‘);
num_pattern = round(samplingRatio * num_pixel * num_pixel); % number of illumination patterns
patterns = rand(num_pixelnum_pixelnum_pattern);
measurements = sum(sum(repmat(im[11num_pattern]) .* patterns));
measurements = reshape(measurements[]1);
%% initialization
[row col m] = size(patterns);
P = reshape(patterns [row*col m]);
P = P‘; % each row represents a pattern
if para.x0flag == 1
para.x0 = pinv(P)*measurements;
else
para.x0 = ones(row * col1);
end
%% 1. SPI differential ghost imaging (DGI) reconstruction
ind = 1;
fprintf(‘Begin reconstruction of DGI. \n‘);
tic
[im_r_DGI] = fun_SPI_R_DGI(patterns measurements);
runTime(ind2) = toc;
figureimshow(im_r_DGI[]‘InitialMagnification‘1000); title(‘Recovered im using DGI method‘);
im_r(::ind) = im_r_DGI;
%% 2. SPI gradient descent (GD) reconstruction
ind = 2;
fprintf(‘Begin reconstruction of GD. \n‘);
tic
[im_r_GD totaliter] = fun_SPI_R_GD(patterns measurements para);
runTime(ind2) = toc;
runTime(ind1) = totaliter;
figureimshow(im_r_GD[]‘InitialMagnification‘1000); title(‘Recovered im using GD method‘);
im_r(::ind) = im_r_GD;
%% 3. SPI conjugate gradient descent (CGD) reconstruction
ind = 3;
fprintf(‘Begin reconstruction of CGD. \n‘);
tic
[im_r_CGD totaliter] = fun_SPI_R_CGD(patterns measurements para);
runTime(ind2) = toc;
runTime(ind1) = totaliter;
figureimshow(im_r_CGD[]‘InitialMagnification‘1000); title(‘Recovered im using CGD method‘);
im_r(::ind) = im_r_CGD;
%% 4. SPI Poisson maximum likelihood reconstruction
ind = 4;
fprintf(‘Begin reconstruction of Poisson. \n‘);
tic
[im_r_Poisson totaliter] = fun_SPI_R_Poisson(patterns measurements para);
runTime(ind2) = toc;
runTime(ind1) = totaliter;
figureimshow(im_r_Poisson[]‘InitialMagnification‘1000); title(‘Recovered im using Poisson method‘);
im_r(::ind) = im_r_Poisson;
%% 5. SPI alternating projection (AP) reconstruction
ind = 5;
fprintf(‘Begin reconstruction of AP. \n‘);
tic
[im_r_AP totaliter] = fun_SPI_R_AP(patterns measurements para);
runTime(ind2) = toc;
runTime(ind1) = totaliter;
figureimshow(im_r_AP[]‘InitialMagnification‘1000); title(‘Recovered im using AP method‘);
im_r(::ind) = im_r_AP;
%% 6. SPI Sparse representa
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4714 2017-06-22 17:46 Demo.m
文件 806 2017-10-24 15:52 fun_error.m
文件 2042 2017-11-21 16:05 fun_SPI_R_AP.m
文件 1949 2017-11-21 16:11 fun_SPI_R_CGD.m
文件 1414 2016-06-29 06:22 fun_SPI_R_DGI.m
文件 2045 2017-06-22 10:10 fun_SPI_R_GD.m
文件 2648 2017-06-22 10:10 fun_SPI_R_Poisson.m
文件 4674 2017-10-21 17:30 fun_SPI_R_Sparse.m
文件 5691 2017-10-24 15:54 fun_SPI_R_TV.m
文件 4655 2017-10-24 15:54 README.txt
- 上一篇:硬币统计matlab
- 下一篇:matlab 两种自适应数值积分算法
相关资源
- matlab 两种自适应数值积分算法
- 硬币统计matlab
- 菲涅尔衍射仿真matlab程序
- 有限元平面应力及桁架机构matlab代码
- 使用matlab进行质心计算
- APF的Matlab仿真
- 一级直线倒立摆的LQR控制
- tikhonnov正则化matlab代码包括L曲线法求
- matlab 图片批量处理
- stomp算法matlab实现
- 杜芬振子庞加莱截面MATLAB代码
- 基于SCL的1024bit的polar code 的matlab仿真
- 遗传算法matlab程序m文件
- 自校正GPC matlab仿真
- matlab中用GUI实现串口实时显示波形
- 模糊C均值聚类图像分割算法matlab实现
- 16QAM调制解调
- 基于直方图的阈值分割的matlab实现
- GMM-matlab
- matlab遗传算法求最短路径
- matlab 图像处理 GUI 摄像头拍照,代码
-
倒立摆在matlab的simuli
nk库下的仿真 - 基于MATLAB的配电网30节点潮流计算
- 基于MATLAB的图像SVM分类
- 基于MATLAB的同步发电机励磁系统仿真
- emma_matlab
- XFEM的程序
- 蚁群算法粗糙集matlab代码
- 均值滤波和中值滤波matlab代码
- 小波变换 matlab
评论
共有 条评论