# Multi-Camera Person Re-Identification Based on Trajectory Data
## 2 Materials and Methods
### Data Preparation  
This section outlines the steps involved in the data preparation process applied to the dataset. Figure 4 provides a visual representation of the data preparation pipeline.  
After obtaining the projections, we started data preparation by adjusting them to align with the floorplan's dimensions. This was achieved through a coordinate rescaling to fit the provided store map. Then, to obtain the exact time of each detection we used features such as video name and frame number, especially since each day's recording was segmented into shorter videos. The frame number corresponds to the detection frame within its corresponding video. Each video has a length (L) of 36 s, captured at 20 frames per second (fps), which corresponds to 120 of accelerated time. Therefore, the accelerationfactor (a) is determined as 720/120 = 6. The detection time is calculated based on the following formula:  
\[\frac{(vn-1)\times L\times fps+df}{a}=s \tag{1}\]  
where \(vn\) is the detection video number, \(L\) is the video length, \(fps\) is the video frame rate, \(df\) is the frame number in the video where the detection was made, \(a\) is the acceleration rate, and \(s\) corresponds to the number of seconds from the time the camera started recording. After this, we just have to add the result to the time the camera started recording to find the time whose detection was identified. Consider an example where a person is present in video 4 at frame number 300, and the camera that captured this person started recording at 09:00:00. The time associated with the corresponding detection is calculated as follows:  
\[\frac{3\times 720+300}{6}=410\;\mathrm{s}\]  
09:00:00 + 410 \(\mathrm{s}\longrightarrow\) 09:06:50  
Given that we applied the tracking algorithm separately for each camera's videos, most of the customer IDs were duplicates. This duplication occurred because the IDs for each camera began with the number 1. To ensure the uniqueness of each ID, we adjusted the customer ID by adding the last ID of one camera to the IDs of the subsequent camera.  
After having the data projected in the store map, we noticed that the points too distant from the camera position were not accurate when compared with the trajectory performed by the customers. Such deviations could stem from errors in the homography matrix computation or from the inclusion of low-confidence detections. Given that these points were not relevant to our primary objective, we decided to focus on a specific area of interest (AoI) for the re-identification. The AoI is represented in Figure 5. The zones painted in black and gray correspond to shelves and map delimitation, respectively.  
To enhance the quality of the available data, we used a filtering criterion by eliminating static points associated with a unique ID whose position did not change over time (i.e., removing customer data points that remain in a constant position across all related detections). Such a measure aims to mitigate errors from false positives that can be produced by the object detector. For example, a stationary object like a chair might be wrongly identified as a person. The position of the points belonging to that ID will not change over time, making it a good exclusion criterion. In contrast, real people are expected to move, especially when entering or exiting the camera's field of view. Therefore, this criterion will distinguish real customers from erroneous detections.  
Figure 4: Data preparation pipeline.