idtrackerai

Post-processing

Impossible velocity jumps correction

correct_impossible_velocity_jumps.compute_neighbour_fragments_and_velocities(video, list_of_fragments, fragment)[source]

Computes the fragments with the same identities to the past and to the future of a given fragment and gives the velocities at the extremes of the current fragment

Parameters:
video : <Video object>

Object collecting all the parameters of the video and paths for saving and loading

list_of_fragments : <ListOfFragments object>

Object collecting the list of fragments and all the statistics and methods related to them

fragment : <Fragment object>

Object collecting all the information for a consecutive set of overlapping blobs that are considered to be the same animal

Returns:
neighbour_fragment_past : <Fragment object>

Fragment object with the same identity as the current fragment in the past

neighbour_fragment_future : <Fragment object>

Fragment object with the same identity as the current fragment in the future

velocities_between_fragments : nd.array

Velocities needed to connect the current fragment to its consecutive fragments in the past and in the future.

correct_impossible_velocity_jumps.compute_velocities_consecutive_fragments(neighbour_fragment_past, fragment, neighbour_fragment_future)[source]

Compute velocities in the extremes of a fragment with respecto to its neighbour_fragment_past and neighbour_fragment_future

Parameters:
neighbour_fragment_past : <Fragment object>

Fragment object with the same identity as the current fragment in the past

fragment : <Fragment object>

Object collecting all the information for a consecutive set of overlapping blobs that are considered to be the same animal

neighbour_fragment_future : <Fragment object>

Fragment object with the same identity as the current fragment in the future

Returns:
velocities : list

List with the velocity needed to link the fragment with its fragment in the past and in the future

See also

Fragment
correct_impossible_velocity_jumps.correct_impossible_velocity_jumps(video, list_of_fragments)[source]

Corrects the parts of the video where the velocity of any individual is higher than a particular velocty threshold given by video.velocity_threshold. This check is done from the video.first_frame_first_global_fragment to the past and to the future

Parameters:
video : <Video object>

Object collecting all the parameters of the video and paths for saving and loading

list_of_fragments : <ListOfFragments object>

Object collecting the list of fragments and all the statistics and methods related to them

correct_impossible_velocity_jumps.correct_impossible_velocity_jumps_loop(video, list_of_fragments, scope=None)[source]

Checks whether the velocity needed to join two consecutive fragments with the same identity is consistent with the typical velocity of the animals in the video (video.velocity_threshold). If the velocity is not consistent the identity of one of the fragments is reassigned. The check is performed from the video.first_frame_first_global_fragment to the past or to the future according to the scope

Parameters:
video : <Video object>

Object collecting all the parameters of the video and paths for saving and loading

list_of_fragments : <ListOfFragments object>

Object collecting the list of fragments and all the statistics and methods related to them

scope : string

If scope = to_the_past the check is performed to the past and if scope = to_the_future the check is performed to the future.

correct_impossible_velocity_jumps.get_fragment_with_same_identity(video, list_of_fragments, fragment, direction)[source]

Get the neighbour_fragment with the same identity in a given direction

Parameters:
video : <Video object>

Object collecting all the parameters of the video and paths for saving and loading

list_of_fragments : <ListOfFragments object>

Object collecting the list of fragments and all the statistics and methods related to them

fragment : <Fragment object>

Object collecting all the information for a consecutive set of overlapping blobs that are considered to be the same animal

direction : string

If direction = to_the_past gets the neighbour_fragment in the past direction = to_the_future gets the neighbour_fragment in the future

Returns:
neighbour_fragment : <Fragment object>

Fragment object with the same identity in a given direction

number_of_frames_in_direction : int

Number of frames to find the neighbour_fragment from a given extreme of the fragment

See also

Fragment
correct_impossible_velocity_jumps.reassign(fragment, fragments, impossible_velocity_threshold)[source]

Reassigns the identity of a given fragment considering the identity of the fragments coexisting with it and the impossible_velocity_threshold

Parameters:
fragment : <Fragment object>

Object collecting all the information for a consecutive set of overlapping blobs that are considered to be the same animal

fragments : list

List with all the Fragment objects of the video

impossible_velocity_threshold : float

If the velocity needed to link two fragments is higher than this threshold the identiy of one of the fragments is considerd to be wrong as it would be physically impossible for an animal to move so much. See video.velocity_threshold for each definition

See also

fragment.Fragment
get_available_and_non_available_identities()
get_candidate_identities_by_minimum_speed()
get_candidate_identities_above_random_P2()

Assign crossings

Get trajectories

Produces the dictionary of outputs containing the individual trajectories (centroids), the git output, the path to the video whose tracking poroduced the individual trajectories and frames_per_second.