## 3 Material and Methods
### Method Verification
#### 3.4.1 Automating Eye-Tracking Measurement  
The main goal of the eye-tracking camera image analysis method used in this study was to gather information from each frame of the video about the location of the turnout switches in the image, their switching status, and the fact that the subject directed his or  
Figure 5: Membership functions for the output variable. her gaze to one of them. The primary tool used for this purpose was cascade classifiers, available in the OpenCV library based on machine learning. The stored information was analyzed to look for the occurrence of an assumed sequence of events. A block diagram of the program's operation is shown in Figure 6.  
The cascaded architecture classifier available in the OpenCV library is based on an algorithm developed by [PERSON] and [PERSON], which initially allowed detection based on only one set of features--Haar wavelets. In later years, the technique was improved, and  
Figure 6: Block diagram of the program. the possibility of using so-called diagonal features was added. The collections extended by this part are called Haar-type features--another refinement of cascades introduced in cooperation with local binary patterns (LBP). The mechanism of operation of the classifier using local binary patterns is to divide the source image into rectangular regions and calculate LBP values of pixel intensity levels for them. Based on these, histograms are determined for each region and stored as a vector. These are then compared with the vectors of histograms developed in the training process and, depending on the degree of agreement, the sample is finally classified as positive or negative. The algorithm's result is finding the object for which the cascade was trained in the image under analysis. Because of the need to detect switches that may be in two position states, two classifiers were used, each responsible for finding a switch in each position. Along with the OpenCV library, cascade classifiers trained to detect certain features have been made available. However, they focus on detecting human silhouettes, faces, eyes, and license plates. To recognize other objects, it is necessary to train the cascades on their images. This is undertaken using the opencv_trancascade application, which is available from the OpenCV library. The process of preparing samples and training the cascade classifier available in the OpenCV library can be divided into the following steps:  
1. A collection of images of the object to be detected, known as positive samples, should contain the object of interest from different perspectives. Next, the coordinates of the rectangular frames bounding the item of interest on each sample must be indicated. To make this laborious and time-consuming step more accessible, we used the opencv_annotation tool, which allows objects in the image to be surrounded by rectangles using a computer mouse. 2. A vector output file was created with positive samples using the createsamples tool from the OpenCV library. It takes the objects indicated in the previous step and normalizes them to the desired size. It is possible to generate new positive examples by, among other things, geometric transformations or adding noise to the selected samples. This is a helpful feature when a small amount of training material is available, although it is not as effective as providing unaltered but different images. 3. Collecting or generating negative samples are images that do not contain the objects to be detected. The best results originate from data from the same source as the positive samples, such as comparable frames from the analyzed video. It is also possible to use images that do not contain the elements of interest. 4. The final stage is training the cascade. It tests approximately 100,000 features in each training window for all positive and negative examples. This process can take many hours or even days, depending on the number of samples provided and the parameters set. With the classifiers trained, one can analyze the eye-tracking camera image.