
%I = imread('faces/Mannenbach.bmp');
%newimage = rotate_image(I, 5, 40, -4, 800);

stop = 1;
x_rot = 0;
y_rot = 0;
z_rot = 0;
scale = 700;
image_path = '';

while (stop ==1)

  if (~isempty(image_path))
	 str = strcat('Enter image_path (default: ', image_path, '):');
  else
	 str = strcat('Enter image_path: ');
  end

  image_path_temp = input(str);

  if (isempty(image_path_temp))
	 image_path_temp = image_path;
  else
	 image_path = image_path_temp;
  end


  if (~isempty(x_rot))
	 str = strcat('Enter degrees to rotate about x-axis [-180 to 180] (default: ', int2str(x_rot), '): ');
  else
    str = input('Enter degrees to rotate about x-axis [-180 to 180]: ')
  end
  x_rot_temp = input(str);

  if (isempty(x_rot_temp))
	 x_rot_temp = x_rot;
  else
	 x_rot = x_rot_temp;
  end

  if (~isempty(y_rot))
	 str = strcat('Enter degrees to rotate about y-axis [-180 to 180] (default: ', int2str(y_rot), '): ');
  else
    str = input('Enter degrees to rotate about y-axis [-180 to 180]: ')
  end
  y_rot_temp = input(str);

  if (isempty(y_rot_temp))
	 y_rot_temp = y_rot;
  else
	 y_rot = y_rot_temp;
  end


  if (~isempty(z_rot))
	 str = strcat('Enter degrees to rotate about z-axis [-180 to 180] (default: ', int2str(z_rot), '): ');
  else
    str = input('Enter degrees to rotate about z-axis [-180 to 180]: ')
  end
  z_rot_temp = input(str);

  if (isempty(z_rot_temp))
	 z_rot_temp = z_rot;
  else
	 z_rot = z_rot_temp;
  end

  if (~isempty(scale))
	 str = strcat('Enter scale factor [400 to 1100] (default: ', int2str(scale), '): ');
  else
    str = input('Enter scale factor [400 to 1100]: ')
  end
  scale_temp = input(str);

  if (isempty(scale_temp))
	 scale_temp = scale;
  else
	 scale = scale_temp;
  end

  %newimage = rotate_image('faces/Pao.bmp', 50, 0, 0, 1000);
  x_rot
  y_rot
  z_rot
  scale
  newimage = rotate_image(image_path, x_rot, y_rot, z_rot, scale);

  stop = input('Would you like to try new values? [1=yes/0=no]');
end

disp('--------------------------------------------------------------');
rotate_path = input('Please save rotate image in which path:');

%imwrite(newimage, 'rotates/I_rotate.bmp', 'bmp');
imwrite(newimage, rotate_path, 'bmp');

disp('--------------------------------------------------------------');
source_path = input('Which face would you like to use:');
target_path = input('Which background would you like to use:');
%court = add_to_image('rotates/I_rotate.bmp', 'backgrounds/white_house.bmp', 0.6);
court = add_to_image(source_path, target_path, 0.6);


disp('--------------------------------------------------------------');
save_or_not = input('Would you like to save this image? [1=yes/0=no]');

if(save_or_not == 1)
	final_path = input('Please save final image in which path:');

	%imwrite(newimage, 'rotates/I_rotate.bmp', 'bmp');
	imwrite(court, final_path, 'bmp');
else
  disp('To try again, type runall');
end



