The implementation of the literature methods is not trivial. After many attempts, I'm looking for a published code to improve my own code.
I refer to measuring methods like those mentioned in:
Article Fundamental diagrams for multidirectional pedestrian flows