A method for detecting a loitering event within an area of interest, AOI, the method comprising the steps of: during a first period of time, receiving a first plurality of object data corresponding to a first person or a first vehicle being detected within the AOI of a monitored scene during the entire first period of time, each object data of the first plurality of object data comprising a first identifier, ID, indicating an identity of the detected first object, position data, and a timestamp, wherein before and after the first period of time, the first person or the first vehicle is not being detected within the AOI of the monitored scene; during a second period of time extending after the end of the first period of time, receiving a second plurality of object data corresponding to a second person or a second vehicle being detected within the AOI of the monitored scene during the entire second period of time, each object data of the second plurality of object data comprising a second identifier, ID, indicating an identity of the detected second object, position data, and a timestamp, wherein before the second period of time, the second person or the second vehicle is not being detected within the AOI of the monitored scene; determining an aggregated time length by: upon determining that the first and second periods of time overlap, calculating a total period of time defined by the first and second periods of time, and setting the aggregated time length to a length of the total period of time; upon determining that the first and second periods of time do not overlap, if the first and second periods of time are separated by an intermediate period of time having a length not exceeding a second threshold time length, determining the aggregated time length to be a sum of a length of the first period of time and a length of the second period of time; otherwise, setting the aggregated time length to zero; detecting a loitering event if the aggregated period time length exceeds a first threshold time length. during a first period of time, receiving a first plurality of object data corresponding to a first person or a first vehicle being detected within the AOI of a monitored scene during the entire first period of time, each object data of the first plurality of object data comprising a first identifier, ID, indicating an identity of the detected first object, position data, and a timestamp, wherein before and after the first period of time, the first person or the first vehicle is not being detected within the AOI of the monitored scene; during a second period of time extending after the end of the first period of time, receiving a second plurality of object data corresponding to a second person or a second vehicle being detected within the AOI of the monitored scene during the entire second period of time, each object data of the second plurality of object data comprising a second identifier, ID, indicating an identity of the detected second object, position data, and a timestamp, wherein before the second period of time, the second person or the second vehicle is not being detected within the AOI of the monitored scene; determining an aggregated time length by: upon determining that the first and second periods of time overlap, calculating a total period of time defined by the first and second periods of time, and setting the aggregated time length to a length of the total period of time; upon determining that the first and second periods of time do not overlap, if the first and second periods of time are separated by an intermediate period of time having a length not exceeding a second threshold time length, determining the aggregated time length to be a sum of a length of the first period of time and a length of the second period of time; otherwise, setting the aggregated time length to zero; detecting a loitering event if the aggregated period time length exceeds a first threshold time length. upon determining that the first and second periods of time overlap, calculating a total period of time defined by the first and second periods of time, and setting the aggregated time length to a length of the total period of time; upon determining that the first and second periods of time do not overlap, if the first and second periods of time are separated by an intermediate period of time having a length not exceeding a second threshold time length, determining the aggregated time length to be a sum of a length of the first period of time and a length of the second period of time; otherwise, setting the aggregated time length to zero; detecting a loitering event if the aggregated period time length exceeds a first threshold time length. if the first and second periods of time are separated by an intermediate period of time having a length not exceeding a second threshold time length, determining the aggregated time length to be a sum of a length of the first period of time and a length of the second period of time; otherwise, setting the aggregated time length to zero; detecting a loitering event if the aggregated period time length exceeds a first threshold time length.