Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict IDs to ROI in masks with multiple ROIs / allow user defined "Look back (frames)" #32

Open
ayexander opened this issue Jan 18, 2023 · 4 comments

Comments

@ayexander
Copy link

ayexander commented Jan 18, 2023

Error description:
I'm using trackR to track individual ants in a multi-chamber setup, which I mask with multiple non-overlapping ROI's. trackR works well to track the ants, but often the resulting ID's/tracks erroneously jump from one ROI to another despite the ants being physically unable to move between chambers. Also, the ROI jumps are longer than the set "Maximum Distance" and occur when ants disappear from view for a number of frames both shorter and longer than the max allowed "Look back (frames)" value of 150.

Possible Solution:
Is it possible to add an option for multiple unique ROI's, such that the ROI's could be numbered and the track ID's assigned to ants/objects within each ROI be restricted to each ROI.

Alternative / Additional Suggestion:
I'm unsure, but it seems that another feature update that might help would be to make the "Look back (frames)" have a max value of the total #frames in the video.

Example Images:
Example images of ROI ID jumps of about 400 pixels in 5 frames and 31 frames despite "Maximum Distance = 30 pixels" when ants disappear for only 5 and 31 frames despite "Look back = 150" is included:
trackR_ROI_error

@sjmgarnier
Copy link
Member

@ayexander I can look into trying to restrict tracks to ROIs but that won't be straightforward and I won't have time to look into this before a couple of months at least. This being said, your choice of parameters is part of the issue I think. I should document that better but the "Maximum Distance" parameter is per frame. This means that if it is set to 30 pixels, trackR will consider all past tracks that end within 30 pixels in the immediately previous frame, within 60 pixels 2 frames back, within 90 pixels 3 frames back, etc. With such a wide "Maximum Distance" and "Look Back", you're bound to see the large jumps that you describe.

I recommend setting the "Maximum Distance" to between 1.5 and 2 times the maximum expected distance moved by an ant between two frames (in your case, I'm guessing it will be something like 1.5 * 10 pixels at most), and "Look Back" to only a few frames, assuming that ants are consistently detected when in the field of view. I'd be happy to have a quick video chat with you to help you identify the best tracking parameters.

@ayexander
Copy link
Author

ayexander commented Jan 24, 2023 via email

@sjmgarnier
Copy link
Member

@ayexander I think I understand your problem. If you have a bit of coding experience, it might be easier to actually reconnect the tracks programmatically during post-processing. Since the tracks are restricted to specific areas, clustering them a posteriori shouldn't be too difficult. Happy to jump on a call with you to explain how to go about with that.

@ayexander
Copy link
Author

ayexander commented Jan 24, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants