\appendix
This chapter contains information to help reproduce the results of \Gaze{} but are not important enough to appear in the main text.
OpenCV offers a tool to store camera calibration settings which can be used for
certain functions to improve their results. \Gaze{} benefits from such functions,
among others it uses solvePnP
which is used to estimate the head pose in @sec:head-pose-estimation. This section
explains briefly how to use the calibration tool. Please note that there is
also a
tutorial
available which provides some videos and a more thorough explanation of the
mathematics.
The calibration tool can be found in OpenCV's samples,
samples/cpp/calibration.cpp.
To be able to use it, OpenCV needs to be compiled manually by providing the
CMake flag -DBUILD_EXAMPLES=ON
to build the cpp-example-calibration
executable. To calibrate the camera, the calibration tool needs to take a
couple of pictures of a benchmark image: a checkerboard pattern as in
@fig:calibcheck is used in the following. Calibration works best if the image
is on a hard surface, like cardboard. An example call to the calibration tool
is denoted in @cl:cvcalibcall. The parameters -h=6
and -w=9
describe the
layout of the checkerboard pattern. It means that the checkerboard is seven
squares down and ten squares across since the parameters expect the numbers of
corners between four squares. -n=10
is the number of images to be taken,
-d=1000
is the delay between two images. A higher delay allows that during
calibration the image can be moved to more divers poses without triggering
another image, resulting in a higher variety of points which in turn leads to a
more exact estimation of the camera parameters. At least three pictures should
be taken, but more images provide better results. The output file to which the
calibration values are written is stored in the file passed with -o
. The last
parameter, -s=0.0015
is the size of one checkerboard square in meters. This
value should be measured on the printout of the checkerboard, as slight
variations can occur depending on page orientation, zoom levels, margins,
printer settings, and other factors. In the example, the printed version's
squares' side lengths were \SI{1.5}{\milli\meter}. After a successful calibration,
camera_calib.yml
will be written into the directory. It can be used to
configure \Gaze{}, as explained in @sec:camera-and-screen-parameters.
./cpp-example-calibration -h=6 -w=9 -n=10 -d=1000 -s=0.0015 -o=camera_calib.yml
To find the effective focal length of a camera the angle of view needs to be
measured, and the sensor size has to be known. For \Gaze{}'s examples the sensor width is
assumed to be \SI{0.0055}{\meter}. After measuring the angle of view, it can be used to solve [@Wikipedia:aov]
\begin{align}
\alpha &= 2 \arctan \frac{d}{2f} \
f &= \frac{d}{2 \tan \frac{\alpha}{2}},
\end{align}
with
@file:assets/gen_files/table-relative-errors-pexels.md
@file:assets/gen_files/table-relative-errors-BioID.md
\newpage
@file:assets/gen_files/table-comptimes-pexels.md
@file:assets/gen_files/table-comptimes-BioID.md
{ #fig:pupildetectioncomparison height=120% }
```{ .cpp file=assets/gaze/src/gaze/gaze_tracker.cpp label=cl:initpipeline caption="The init_pipeline()
method. To extend it properly, a new `else if` case has to be added." shortcaption="The `init_pipeline()` method." lines=71-100 pathdepth=3 }
# References
\setnowidow
\setnoclub
\raggedright
\renewcommand{\footnote}[1]{} <!-- Avoid DOI links to go to footnotes: disable footnotes in general. -->
\begingroup\endgroup