% Simulation Interoperability poor access to four half-pixel low-resolution images,for the reconstruction
% of an analytic high-resolution images, belong to sub-pixel super-resolution technology or technology.
clear;clc;
folder = fullfile(matlabroot, '\toolbox\images\imdemos');
im=imread('cameraman.tif');
im=(double(im))/256;
%im=rgb2gray(im);
s_im=size(im);
w1=window(@tukeywin,s_im(1),0.25);
w2=window(@tukeywin,s_im(2),0.25)';
w=w1*w2;
IM = [zeros(10,s_im(2)+20); zeros(s_im(1),10) im.*w zeros(s_im(1),10); zeros(10,s_im(2)+20)];
clear w w1 w2 s_im;
[IM_hang IM_lie]=size(IM);
im1=zeros(IM_hang,IM_lie/2);
im2=zeros(IM_hang,IM_lie/2);
for i=1:IM_hang
for j=1:IM_lie/2
im1(i,j)=(IM(i,2*j-1)+IM(i,2*j))/2;
end
end
for i=1:IM_hang
for j=1:IM_lie/2-1
im2(i,j)=(IM(i,2*j)+IM(i,2*j+1))/2;
end
end
IM_LR1=zeros(IM_hang/2,IM_lie/2);
for j=1:IM_hang/2
for i=1:IM_lie/2
IM_LR1(i,j)=(im1(2*i-1,j)+im1(2*i,j))/2;
end
end
IM_LR4=zeros(IM_hang/2,IM_lie/2);
for j=1:IM_hang/2
for i=1:IM_lie/2-1
IM_LR4(i,j)=(im1(2*i,j)+im1(2*i+1,j))/2;
end
end
IM_LR2=zeros(IM_hang/2,IM_lie/2);
for j=1:IM_hang/2
for i=1:IM_lie/2
IM_LR2(i,j)=(im2(2*i-1,j)+im2(2*i,j))/2;
end
end
IM_LR3=zeros(IM_hang/2,IM_lie/2);
for j=1:IM_hang/2
for i=1:IM_lie/2-1
IM_LR3(i,j)=(im2(2*i,j)+im2(2*i+1,j))/2;
end
end
clear i j;
[x y]=size(IM_LR1);
A=eye(2*x);
B=eye(2*x-1);
B=[zeros(2*x-1,1),B;zeros(1,2*x)];
A=(A+B)./2;
clear B;
C=zeros(2*x,1);
IMrec1=zeros(2*x,y);
for i=1:y
for ii=1:x
C(2*ii-1,1)=IM_LR1(ii,i);
C(2*ii,1)=IM_LR4(ii,i);
end
IMrec1(:,i)=inv(A)*C;
end
C=zeros(2*x,1);
IMrec2=zeros(2*x,y);
for i=1:y
for ii=1:x
C(2*ii-1,1)=IM_LR2(ii,i);
C(2*ii,1)=IM_LR3(ii,i);
end
IMrec2(:,i)=inv(A)*C;
end
clear i ii C;
[x y]=size(IMrec1);
D=zeros(1,x);
for i=1:x
for ii=1:y
D(1,2*ii-1)=IMrec1(i,ii);
D(1,2*ii)=IMrec2(i,ii);
end
IMrec(i,:)=inv(A)*D';
end
imwrite(IM_LR1,'IM_LR1.jpg','jpg');
imwrite(IM_LR2,'IM_LR2.jpg','jpg');
imwrite(IM_LR3,'IM_LR3.jpg','jpg');
imwrite(IM_LR4,'IM_LR4.jpg','jpg');
figure,imshow(IM);
figure,subplot(1,2,1),imshow(im1);
subplot(1,2,2),imshow(im2);
figure,subplot(2,2,1),imshow(IM_LR1);
subplot(2,2,2),imshow(IM_LR2);
subplot(2,2,3),imshow(IM_LR3);
subplot(2,2,4),imshow(IM_LR4);
figure,subplot(1,2,1),imshow(IMrec1);
subplot(1,2,2),imshow(IMrec2);
figure,imshow(IMrec);
评论0