## 3 Materials and Methods
### Proposed Approach  
Object detection brings substantial information about localization and category of detected objects along with their confidence score as a guarantee that it is the object that is in the center of interest.  
The entire process can be divided into three main steps:  
1. _Motion detection_--Creation of a binary frame, in which only moving objects are recognized by white pixels. The rest of the pixels are black. Sufficient motion signalizes triggering computationally more expensive object detection. Otherwise, only motion detection analyzes the selected environment;
2. _Object detection_--Localization and recognition of multiple objects with an adequate confidence score in the frame;
3. _Object tracking_--This part ensures that detected objects are the same during the trajectory change.  
One of the possible situations is shown in Figure 5, where the view is above the road level. In such circumstances, vehicles move from top to bottom. Undoubtedly, moving  
Figure 4: Object tracking.  
objects can point in the opposite direction. The whole frame is not in the center of interest for assorted reasons, such as parts of the frame that represent background in the form of verdure or the sky. The only center of interest is the road. Vehicles that enter the ROI are detected but counted if the car is completely within the specified region. The trajectory is thus tracked, and we are able to analyze whether it is the same object. Of course, it is important to determine the margin from which we define that the object locates inside.  
One of the possible ways to capture the mentioned scenario is to adjust the view of the camera in front of the vehicle. Figure 6 depicts this scenario and outlines the ROI along with the margin. The vehicle is located inside the margin and is considered to be analyzed.  
In this part, we determine several enhancements to increase the chance to obtain the most reliable results and also reduce the hardware requirements; these include the use of motion detection, the implementation of a ROI in form of the bounding box, the requirement for the whole vehicle to be visible in the image, and use of the confidence score.  
Several non-optimal scenarios may occur during the process of capturing or detection, and many of these are depicted in Figure 7. The first case represents incorrect detection as a result of an exceedingly small bounding box. The second case is similar and presents the opposite scenario, in which the size of a bounding box is too big. The solution is to introduce the reference size of the bounding box based on previous trusted bounding boxes. The object is considered trusted only when its confidence score exceeds the set limit. The third scenario deals with a partially visible bounding box, which is not involved in the analysis because it is not fully visible in the ROI. The last case depicts a potential issue with detection loss in several frames caused by the detection algorithm. In our case, we try to reduce the ROI as much as possible.  
In this stage of development, the ROI does not compensate for the larger movements of the UAV's camera caused by the weather or other related unintentional movement. Should the rapid change occur within the ROI, the user is notified of the possible loss of this region. Then, it is possible to redefine it at a specific time. Other approaches are also possible. The ROI may be tracked, and this would add another step to the processing of the input and would also increase the computational load on the hardware, thus slowing down the whole detection. This approach is also more convenient in case only the video is available from the UAV. Another option is to compensate for the movement directly on the UAV while acquiring video data; research on such tracking of the objects was done by [PERSON] [28]. The  
Figure 5: Proposed approach.  
Figure 6: View of the camera.  
author concludes that the system for tracking is suitable for surveillance applications. The approach proposed by the author may render the need for a ROI redundant.