资源简介
迭代反投影法实现程序,可以用于超分辨率复原。
代码片段和文件信息
function [I frames] = iteratedbackprojection(s delta_est)
% ITERATEDBACKPROJECTION - iterated back projection SR algorithm
% s: images in cell array (s{1} s{2}...)
% factor: gives size of reconstructed image
if nargout > 1
outputframes = true;
else
outputframes = false;
end
%% Initialization
lambda = 0.1; % define the step size for the iterative gradient method
dI1=imread(‘E:\matlab\IBP2\ref.jpg‘);
srcDir=uigetdir(‘E:\matlab\IBP2\ibp11‘); %获得选择的文件夹
cd(srcDir);
allnames=struct2cell(dir(‘*.jpg‘)); %只处理jpg文件
[klen]=size(allnames); %获得jpg文件的个数
for ii=1:len
name=allnames{1ii};
s{ii}=imread(name); %读取文件
end
%% Movie variables
movieCounter = 1;
imOrigBig = imresize(dI1 2 ‘nearest‘);
if(outputframes)
figure;
end
% -- End of Movie Variables
% Start with an estimate of our HR image: we use an upsampled version of
% the first LR image as an initial estimate.
X = imOrigBig;
X_prev = X;
%imshow(X);
%PSF = generatePSF([1 0 0] [1 2 1] X);
blur = [0 1 0;...
1 2 1;...
0 1 0];
blur = blur / sum(blur(:));
sharpen = [0 -0.25 0;...
-0.25 2 -0.25;...
0 -0.25 0];
%% Main loop
% --- Save each movie frame ---
if(outputframes)
imshow(X);
frames(movieCounter) = getframe;
movieCounter = movieCounter + 1;
end
% -----------------------------
G = uint8(zeros(size(X)));
for ii=2:5 %delta_est矩阵中取2到5行
temp = circshift(X -[round(2 * delta_est(ii1)) round(2 * delta_est(ii2))]); %参考帧偏移
%temp = PSF * temp;
temp = imfilter(temp blur ‘symmetric‘);
temp = temp(1:2:end 1:2:end); %降采样
temp = temp - s{ii}; %图像相减
%temp = PSF‘ * temp;
temp = imfilter(temp sharpen ‘symmetric‘);
temp = imresize(temp 2 ‘nearest‘); %插值
P = circshift(temp [round(2 * delta_est(ii1)) round(2 * delta_est(ii2))]);
% disp(class(P));
% disp(class(G));
%disp(size(P));
%disp(size(G));
% G = plus(PG);
% G = G+P;
G = G + circshift(temp [round(2 * delta_est(ii1)) round(2 * delta_est(ii2))]);
end
% Now that we have the gradient we will go in its direction with a step
% size of lambda
X = X + (lambda) * G;
%figure;
%imshow(X);
I = X;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3030 2013-12-09 14:36 iteratedbackprojection.m
- 上一篇:仿VS编辑界面,控件拖拽,属性框
- 下一篇:导线平差计算EXCEL
相关资源
- libpthread.so
- libpcapwinpcap捕获数据包与存储和读取
- libpcap+libpcap-devel
- tcpdump最新版本源码
- libpcap-1.4.0.tar.gz
- libpng-1.6.16.tar.gz
- protobuf2.5 protoc.exe libprotoc.lib libprotob
- DuilibPreview.rar
- linux centos6的libpcre.so.0
- 编译libharu库用于生成Pdf
- libPLS:a Library for PLSR and DA
- 搬运工plsdaplslda代码分享-libPLS_1.95.z
- 将bmp文件转换为png文件的项目,
- libpng-1.2.56.tar.gz
- libpcap-1.1.1.tar
- libpng 1.6 windows 64位 编译好的lib库
- libpcap-0.7.2.tar.gz
评论
共有 条评论