	clear variables;

	% add mirror code to matlab's path for this session
	addpath(genpath([pwd '/Bin']));

	% load bouguet's calibration results
	dataF = './data/Calib_Results_Bouguet.mat';
	[T Ti points K projERR] = LoadData(dataF, [], 1);

	% discard some of the poses
	toDiscard = [1 6 20 26 27 31];
	T(:, : , toDiscard)=[];
	points(toDiscard)=[];

	% run the mirror code with optimisation
	[CamEST infoEST errEST CamOPT infoOPT errOPT] =...
		RealCamEstimation(T, K, points, 1);

	% plot reference frames for real grid (world) and real camera

	hold on;

	worldRef = eye(4);

	PlotRef(eye(4), worldRef, 100);

	PlotCam(CamOPT, worldRef, 100);

	hold off;
	
	% reverse the direction of increasing Y values, so that the reference
	% frames will be represented correctly.
	set(gca,'YDir','reverse');
	
	axis image;
	grid on;
	view(60, 40);
	rotate3d on;
	
	% to verify that the relative positions of the real camera and real
	% grid make sense, see for example data/image-00001_FLIPPED.jpg, which
	% gives an idea of the real scene. the camera in question is the one
	% farthest from the grid.
	
	% if the orientations of the real grid's axes seem confusing, note that
	% they have reversed handedness in relation to the virtual grid's axes.
	% in turn, the virtual grid's axes can be checked via bouguet's
	% extrinsics view centred on the grid.
	
	% if the orientations of the real camera's axes seem confusing, check
	% them via bouguet's extrinsics view centred on the camera.

