quantumjot / btrack

Bayesian multi-object tracking
https://btrack.readthedocs.io
MIT License
310 stars 50 forks source link

Filter tracks by value #406

Open MerihEkin opened 2 months ago

MerihEkin commented 2 months ago

Would it be possible to have an option to filter tracks (area, time) before running the optimization or drop some tracks from the list

quantumjot commented 2 months ago

Absolutely! How do you see this working? Do you want to filter the tracks in Python via your own script?

MerihEkin commented 2 months ago

I am using a library for cell detection that includes some noise. For example, I've noticed that the trajectories associated with noise are usually shorter in duration or cover a smaller area. If I could filter out some trajectories—specifically with respect to track length or the convex hull area covered—between the tracking and optimization steps, I believe it would improve the results.

Alternatively, I can easily compute these parameters for each track, so a function to either drop trajectories by specific indices or retain those with specific indices would also be effective.

For instance:

tracker.track(step_size=100) tracker.filter_tracks_by_index(list_of_track_indices_to_keep/drop) tracker.optimize()

Thank you for considering this feature and for your efforts in maintaining such a useful library.