function gaussianpyramid(filename)

im1=double(imread(filename));
im2=(im1(:,:,1)+im1(:,:,2)+im1(:,:,3))/3; 

para_gauss=1;

for j=1:6
   clear imtemp;
   clear im;
  shape_filter_x=gauss_f(3*para_gauss, para_gauss)';
  shape_filter_y= shape_filter_x' ;
  s=size(im2);
  for i=1:3*para_gauss
  	imtemp(i,:)=im2(1,:);
  	imtemp(s(1)+3*para_gauss+i,:)=im2(s(1),:);
  end
  imtemp(1+3*para_gauss:s(1)+3*para_gauss,:)=im2;
  for i=1:3*para_gauss
    	im(:,i)=imtemp(:,1);
  		im(:,s(2)+3*para_gauss+i)=imtemp(:,s(2));
     end
     
     
     im(:,1+3*para_gauss:s(2)+3*para_gauss)=imtemp;
 
  
  im=conv2(im,shape_filter_x,'same');
  im=conv2(im,shape_filter_y ,'same');
  im=im(1+3*para_gauss:s(1)+3*para_gauss,1+3*para_gauss:s(2)+3*para_gauss);
  im =downsample(im);
  filename =strcat(' ima',num2str(j),'.jpg');
  imwrite(im/255,filename,'jpg');
	
  im2=im ;  
  
  im=upsample(im,j);
   filename =strcat(' imb',num2str(j),'.jpg');
  imwrite(im/255,filename,'jpg');

end

