To Place An Image Over The Other
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I have a problem with the following coding:
% Frequency Of The First Row
fx1=3.5;fy1=2;
fx2=7;fy2=2;
fx3=10.5;fy3=2;
fx4=14;fy4=2;
% Frequency Of The Second Row
fx5=17.5;fy5=2;
fx6=21;fy6=2;
fx7=24.5;fy7=2;
fx8=28;fy8=2;
% Frequency Of The Third Row
fx9=31.5;fy9=2;
fx10=35;fy10=2;
fx11=38.5;fy11=2;
fx12=42;fy12=2;
% Frequency Of The Fourth Row
fx13=45.5;fy13=2;
fx14=49;fy14=2;
fx15=52.5;fy15=2;
fx16=56;fy16=2;
% Bigger Pupil
[x1,y1]=meshgrid(-1:2/511:1, -1:2/511:1);
circ1=sqrt(x1.^2+y1.^2)<1;
z4=(sqrt(3).*(2.*(x1.^2+y1.^2)-1)); % Defocous
figure(1)
imagesc(z4); colormap gray; axis image; axis off
% Smaller Holograms
M=zeros(512);
a=128;
b=128;
[x,y]=meshgrid(-1:2/127:+1, -1:2/127:+1);
circ=sqrt(x.^2+y.^2)<1;
% Generation Of Holograms
h1=circ.*(cos((x*pi*fx1)+(y*pi*fy1)))>0;
h2=circ.*(cos((x*pi*fx2)+(y*pi*fy2)))>0;
h3=circ.*(cos((x*pi*fx3)+(y*pi*fy3)))>0;
h4=circ.*(cos((x*pi*fx4)+(y*pi*fy4)))>0;
h5=circ.*(cos((x*pi*fx5)+(y*pi*fy5)))>0;
h6=circ.*(cos((x*pi*fx6)+(y*pi*fy6)))>0;
h7=circ.*(cos((x*pi*fx7)+(y*pi*fy7)))>0;
h8=circ.*(cos((x*pi*fx8)+(y*pi*fy8)))>0;
h9=circ.*(cos((x*pi*fx9)+(y*pi*fy9)))>0;
h10=circ.*(cos((x*pi*fx10)+(y*pi*fy10)))>0;
h11=circ.*(cos((x*pi*fx11)+(y*pi*fy11)))>0;
h12=circ.*(cos((x*pi*fx12)+(y*pi*fy12)))>0;
h13=circ.*(cos((x*pi*fx13)+(y*pi*fy13)))>0;
h14=circ.*(cos((x*pi*fx14)+(y*pi*fy14)))>0;
h15=circ.*(cos((x*pi*fx15)+(y*pi*fy15)))>0;
h16=circ.*(cos((x*pi*fx16)+(y*pi*fy16)))>0;
% An Array Of 4x4 Holograms(Concatenation)
% First Row Of Holograms
M(1:a, 1:b) = h1; %M(1, 1)
M(1:a, b+1:b*2) = h2; %M(2, 1)
M(1:a, 2*b+1:b*3) = h3; %M(3, 1)
M(1:a, 3*b+1:b*4) = h4; %M(4, 1)
% Second Row Of Holograms
M(a+1:a*2, 1:b) = h5;%M(1, 2)
M(a+1:a*2, b+1:b*2) = h6; %M(2, 2)
M(a+1:a*2, 2*b+1:b*3) = h7; %M(3, 2)
M(a+1:a*2, 3*b+1:b*4) = h8; %M(4, 2)
% Third Row Of Holograms
M(2*a+1:a*3, 1:b) = h9; %M(1, 3)
M(2*a+1:a*3, b+1:b*2) = h10; %M(2, 3)
M(2*a+1:a*3, 2*b+1:b*3) = h11; %M(3, 3)
M(2*a+1:a*3, 3*b+1:b*4) = h12; %M(4, 3)
% Fourth Row Of Holograms
M(3*a+1:a*4, 1:b) = h13; %M(1, 4)
M(3*a+1:a*4, b+1:b*2) = h14; %M(2, 4)
M(3*a+1:a*4, 2*b+1:b*3) = h15; %M(3, 4)
M(3*a+1:a*4, 3*b+1:b*4) = h16; %M(4, 4)
figure(2)
imagesc(M),colormap gray; axis image; axis off
title('Array Of 4x4 Holograms');
*******
In the above coding in figure (1) a 512x512 matrix is generated with a particular aberration(defocus) and in figure (2) 16 holograms of each dimension 128x128 is generated. My problem is that I want to place these 16 holograms or incorporate these 16 holograms in the bigger matrix of 512x512(i.e. in figure 1). So, instead of two figures I need one figure where all these 16 holograms are described over the bigger one. Can anyone please help me out in this regard?
Thanking You!
0 Kommentare
Antworten (1)
Image Analyst
am 22 Aug. 2012
Stitch them together like
bigImage = [...
image11, image12, image13, image14;...
image21, image22, image23, image24;...
image31, image32, image33, image34;...
image41, image42, image43, image44];
0 Kommentare
Siehe auch
Kategorien
Mehr zu Image Filtering and Enhancement finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!