% % % % Optical Imaging and Spectroscopy % % David J. Brady % Duke University % www.opticalimaging.org % % Aliased filter images Figures 7.9 and 7.10 % figure(1);set(gcf,'color','white'); figure(2);set(gcf,'color','white'); xrange=linspace(-2,62,512); yrange=linspace(-2,14,128); % % one wavelength is 4 samples % [x,y]=meshgrid(xrange,yrange); imgD=(1+cos(2*pi*((x+2).^2/128+(y+2).^2/200)))/2; figure(1);subplot(5,1,1,'align');imagesc(xrange(19:497),yrange(9:120),imgD(9:120,19:497));colormap 'gray'; title('0bject field'); axis image; figure(2);subplot(5,1,1);plot(xrange(19:497),imgD(64,19:497),'-k');axis tight; title('0bject field'); fnumber=1; h=jinc(sqrt((x-30).^2+(y-6).^2)/fnumber).^2; h=h(33:98,225:288); imgL=conv2(imgD,h,'same'); imgL=imgL/max(max(imgL)); figure(1);subplot(5,1,2,'align');imagesc(xrange(19:497),yrange(9:120),imgL(9:120,19:497));colormap 'gray'; title('Optically filtered');axis image; figure(2); subplot(5,1,2);plot(xrange(19:497),imgL(64,19:497),'-k');axis tight; title('Optically filtered'); % Effect of down sampling % % sampling at one half wavelength scale % dSr=kron(eye(256),[1 1 ])/2; dSl=kron(eye(64),[1 1])/2; dxrange=linspace(-2,62,256); dyrange=linspace(-2,14,64); imgLd1=dSl*imgL*dSr'; figure(1);subplot(5,1,3,'align');imagesc(dxrange(10:248),dyrange(5:60),imgLd1(5:60,10:248));colormap 'gray'; title('Critically sampled');axis image; figure(2);subplot(5,1,3);plot(dxrange(10:248),imgLd1(32,10:248),'-k');axis tight; title('Critically sampled'); % sampling at one wavelength scale % dSr=kron(eye(128),[1 1 1 1])/4; dSl=kron(eye(32),[1 1 1 1])/4; dxrange=linspace(-2,62,128); dyrange=linspace(-2,14,32); imgLd1=dSl*imgL*dSr'; figure(1);subplot(5,1,4,'align');imagesc(dxrange(5:124),dyrange(3:30),imgLd1(3:30,5:124));colormap 'gray'; title('2x undersampled'); axis image; figure(2);subplot(5,1,4);plot(dxrange(5:124),imgLd1(16,5:124),'-k');axis tight; title('2x undersampled '); % sampling at two wavelength scale % dSr=kron(eye(64),[1 1 1 1 1 1 1 1])/8; dSl=kron(eye(16),[1 1 1 1 1 1 1 1])/8; dxrange=linspace(-2,62,64); dyrange=linspace(-2,14,16); imgLd1=dSl*imgL*dSr'; figure(1);subplot(5,1,5,'align');imagesc(dxrange(3:62),dyrange(2:15),imgLd1(2:15,3:62));colormap 'gray'; title('4x undersampled '); axis image;xlabel('\lambda f/#'); figure(2);subplot(5,1,5);plot(dxrange(3:62),imgLd1(8,3:62),'-k');axis tight; title('4x undersampled');xlabel('\lambda f/#'); h=figure(2); set(h,'papersize',[6 9]); hp=figure(1); set(hp,'papersize',[6 9]);