% Script to make stereographs from a grayscale height map. % Copyright Jonathan Lansey 2007 % Question and comments to Jonathan: JCL7 at njit dot edu % Put the 3d grayscale data in a file 'antarcticaData.bmp' % Put the background graphic in 'AntarcticaBkg.bmp' % the width of the background graphic should be thin, I use 200 pixels % the height of the graphic should be longish and equal to the height of the antarctica graphic clear % clears your workspace of all annoying variables A=imread('Data.bmp','bmp'); % reads in data, feel free to change a=double(A(:,:,1)); % Necessary to change it from a 'int8' number to normal ones. also only reads one of the three colors. since its grayscale, thats all we need. % bkg=imread('AntarcticaBkg.bmp','bmp');% read in background grayscale file bkg=imread('Color.background.bmp'); bkgWidth=size(bkg,2); bkgLength=size(bkg,1); % is really height M=bkg; %initialize M, which is going to be the main image file t=5; % The number of times your pattern is repeated. 't' should be no larger than width(Data)/width(background) so don't be stupid. c=50; % Make this big for your data to pop out more, small to pop out less (its num pixels shifted) H=0; % This sets a minimum height above zero, to make a profile stick out more p=round(c*a/255+H).*round(a./(a+eps)); % clever line, note image data is read with nums 0-255 for cur=1:t %number of times pattern repeats for i=1:bkgLength for j=1:bkgWidth q=p(i,j+bkgWidth*(cur-1)); M(i,(j+bkgWidth*cur-q),:)=M(i,j+bkgWidth*(cur-1),:); end end end %end repeat pattern cur=t+1; % Repeat once more for nice edges. for i=1:bkgLength for j=1:bkgWidth q=0; M(i,(j+bkgWidth*cur-q),:)=M(i,j+bkgWidth*(cur-1),:); end end % Plotting and saving! figure(1) image(M) saveas(1,'Antarctica1.jpg') % Copyright Jonathan Lansey 2007 %