On the other hand, using the sum of the length of all segments could lead to false positives.
we only rely on the longest segment and use the size parameter of the average filter to balance the fragmentation.