mooch443 / trex

TRex, a fast multi-animal tracking system with markerless identification, and 2D estimation of posture and visual fields.
https://trex.run
GNU General Public License v3.0
82 stars 8 forks source link

manually setting origin #189

Open miller1875 opened 1 year ago

miller1875 commented 1 year ago

is there a way to manually set the origin (0,0) in a video?

mooch443 commented 1 year ago

You mean when the tracking data is being exported? You can choose the center instead of top-left by changing output_centered = true in the settings, but there is currently no option to arbitrarily choose an origin point. Also, this only affects the X and Y coordinates in the output data. Are you recommending this feature to be added, or does this suffice?

miller1875 commented 1 year ago

So we have the camera view on the screen but due to discrepancies in the set-up between videos the area of interest within that view shifts slightly. So if we wanted to know where in the area a fish is we are having to subtract the distance from the edge of the video to the start of the experimental area but this is quite time consuming. So we were wondering if there was a way to manually set up the area of interest at the start of each video so it's at (0,0). Any other suggestions to work around this would also be very useful!

roaldarbol commented 1 year ago

@mooch443 Sounds like maybe an alternative, kind of a mesh between crop_offsets and track_ignore feature - being able to draw the cropped region that should be included. What do you think of that? I'd assume the backend solution (namely the drawing and cropping functionality) is mostly in place for such an addition. Hope you're doing well! :-)

mooch443 commented 1 year ago

Using crop_offsets could be a way to set 0,0 to the same point - of course this only works if your data is otherwise quite similar. Meaning particularly that it's not rotated.

In the past we have done something like this by... clicking on the background in TRex for each video where you want your 0,0 to be, noting down that point (displayed in the GUI), and then saving this in a CSV file. Can then be used to subtract from the exported data during analysis. It seems to me at least that you say "it shifts slightly" that there wouldn't be an automatic way to tell where exactly 0,0 is, right? So in the end you'll have to click on it anyway. Might as well note it down at that point. And if I imagine doing analysis in some kind of R/Python script, subtracting a value from a CSV file corresponding to the current video does not seem too much work.

But do let me know if I misunderstand the problem :-) At least right now I am not sure how to automate this better - I will add a todo for setting a custom 0,0 in the GUI though, thanks.