nicetoolbox.detectors.feature_detectors.kinematics.utils¶
Utility functions for visualizing motion data (kinematics component).
Functions
Creates a video with evolving line graphs for each frame. |
|
Combines a video frame with the plots for PersonL and PersonR up to the current frame. |
|
Visualizes the mean of motion magnitude by body part across frames for multiple people and cameras. |
- nicetoolbox.detectors.feature_detectors.kinematics.utils.create_video_evolving_linegraphs(frames_data_list, data, categories, global_min, global_max, output_folder, file_name=None, video_fps=30.0)[source]¶
Creates a video with evolving line graphs for each frame.
This function takes a list of frames and data for two people, and creates a video where each frame is combined with line graphs of the data up to that frame. The line graphs are color-coded based on categories.
- Parameters:
frames_data_list (list of str) – The list of paths to the frames to be included in the video.
data (list of numpy.ndarray) – The data to be plotted. Each array represents data for a person.
categories (list of str) – The categories for the data. Each category corresponds to a line on the graph.
global_min (float) – The minimum value across all data. Used to set the y-axis limit.
global_max (float) – The maximum value across all data. Used to set the y-axis limit.
output_folder (str) – The path to the folder where the video will be saved.
file_name (str, optional) – The name of the output video file. If not provided, defaults to ‘movement_score_on_video’.
video_fps (float, optional) – The frames per second of the output video. Defaults to 30.0.
- Returns:
None
- nicetoolbox.detectors.feature_detectors.kinematics.utils.frame_with_linegraph(frame, data, categories, current_frame, global_min, global_max)[source]¶
Combines a video frame with the plots for PersonL and PersonR up to the current frame.
This function takes a video frame and data for two people, and combines the frame with line graphs of the data up to the current frame.
- Parameters:
frame (numpy.ndarray) – The video frame to which the line graphs will be added.
data (list of numpy.ndarray) – The data to be plotted. Each array represents data for a person.
categories (list of str) – The categories for the data. Each category corresponds to a line on the graph.
current_frame (int) – The current frame number. Only data up to this frame will be plotted.
global_min (float) – The minimum value across all data. Used to set the y-axis limit.
global_max (float) – The maximum value across all data. Used to set the y-axis limit.
- Returns:
The video frame combined with the line graphs.
- Return type:
combined_img (numpy.ndarray)
- nicetoolbox.detectors.feature_detectors.kinematics.utils.visualize_mean_of_motion_magnitude_by_bodypart(data, bodyparts_list, output_folder, people_names=None, camera_names=None) None[source]¶
Visualizes the mean of motion magnitude by body part across frames for multiple people and cameras.
- Parameters:
data (ndarray) – The input data array of shape (#persons, #cameras, #frames, #bodyparts(3)).
bodyparts_list (list) – The list of body parts to visualize.
output_folder (str) – The path to the output folder where the plots will be saved.
people_names (list, optional) – The list of names for each person. Defaults to None.
camera_names (list, optional) – The list of names for each camera. Defaults to None.
- Returns:
None