idtrackerai

Post-processing

Impossible velocity jumps correction

Assign crossings

assign_them_all.clean_individual_blob_before_saving(blobs_in_video)[source]

Clean inidividual blobs whose identity is a list (it cannot be, hence an occluded identity has been assigned to an individual blob).

assign_them_all.close_trajectories_gaps(video, list_of_blobs, list_of_fragments)[source]

This is the main function to close the gaps where animals have not been identified (labelled with identity 0), are crossing with another animals or are occluded or not segmented.

Parameters:

video : <Video object>

Object containing all the parameters of the video.

list_of_blobs : <ListOfBlobs object>

Object with the collection of blobs found during segmentation with associated methods. See list_of_blobs.ListOfBlobs

list_of_fragments : <ListOfFragments object>

Collection of individual and crossing fragments with associated methods. See list_of_fragments.ListOfFragments

Returns:

list_of_blobs : <ListOfBlobs object>

ListOfBlobs object with the updated blobs and identities that close gaps

See also

set_individual_with_identity_0_as_crossings(), compute_erosion_disk(), compute_model_velocity(), reset_blobs_in_video_before_erosion_iteration(), interpolate_trajectories_during_gaps(), closing_gap_stopping_criteria(), clean_individual_blob_before_saving()

assign_them_all.get_forward_backward_list_of_frames(gap_interval)[source]

input: gap_interval: array of tuple [start_frame_number, end_frame_number] output: [f1, fn, f2, fn-1, …] for f1 = start_frame_number and

fn = end_frame_number
assign_them_all.reset_blobs_in_video_before_erosion_iteration(blobs_in_video)[source]

Resets the identity of crossings and individual with multiple identities before starting a loop of intepro()

Parameters:

blobs_in_video : type

Description of parameter blobs_in_video.

Returns:

type

Description of returned object.

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.

get_trajectories.assign_point_to_identity(centroid, identity, frame_number, centroid_trajectories)[source]

Populate the matrix of individual trajectories with the centroid of a selected Blob object (see Blob)

Parameters:

centroid : tuple

(x, y)

identity : int

Identity to be associated with the centroid

frame_number : int

Frame number in the tracked video

centroid_trajectories : ndarray

array of shape [number of frame in video x number of animals x 2]

Returns:

ndarray

centroid_trajectories

get_trajectories.produce_output_dict(blobs_in_video, video)[source]

Outputs the dictionary with keys: trajectories, git_commit, video_path, frames_per_second

Parameters:

blobs_in_video : list

List of all blob objects (see Blobs) generated by considering all the blobs segmented from the video

video : <Video object>

See Video

Returns:

dict

Output dictionary containing trajectories as values

get_trajectories.produce_trajectories(blobs_in_video, number_of_frames, number_of_animals)[source]

Produce trajectories array from ListOfBlobs

Parameters:

blobs_in_video : <ListOfBlobs object>

number_of_frames : int

Total number of frames in video

number_of_animals : int

Number of animals to be tracked

Returns:

dict

Dictionary with np.array as values (trajectories organised by identity)