diplomat.wx_gui.fpe_editor.FPEEditor¶
- class diplomat.wx_gui.fpe_editor.FPEEditor(*args: Any, **kwargs: Any)[source]¶
Bases:
FrameMain Forward Backward Editor Frame.
- __init__(parent, video_hdl: VideoCapture, poses: Pose, names: List[str], plot_settings: Mapping[str, Any], crop_box: Tuple[int, int, int, int] | None, labeling_modes: List[PoseLabeler], score_engines: List[ScoreEngine], identity_swapper: IdentitySwapper | None = None, part_groups: List[str] | None = None, manual_save: Callable | None = None, heatmap_options: HeatmapOptions | None = None, debug: bool = False, w_id=wx.ID_ANY, title='', pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, name='FPEEditor')[source]¶
Construct a new FBEditor UI.
- Parameters:
parent – The parent window, can be None.
video_hdl – A cv2.VideoCapture, the video to display to the user.
poses – Pose object, being the poses produced by the FB Algorithm…
names – A list of strings, being the names of the body parts…
plot_settings – The video_metadata object from the predictor plugin, includes important point and video settings.
crop_box – The cropping box of the video which poses were actually predicted on. The format is: (x, y, width, height)…
labeling_modes – A list of pose labelers, labeling modes to enable in the UI.
score_engines – A list of scoring engines to produce scores in the UI.
identity_swapper – An identity swapper object, enables identity swapping functionality in the UI.
part_groups – An optional list of integers, the group to place a body part in when building the selection list on the side.
manual_save – Optional callable, executed when the save button in the UI is pressed. If not set, no save option shows up in the toolbar.
heatmap_options – Optional settings for displaying heatmap overlays in the UI. See the HeatmapOptions dataclass…
debug – Enable debug features of the editor.
w_id – The WX ID of the window. Defaults to wx.ID_ANY
title – String title of the window. Defaults to “”.
pos – WX Position of the window. Defaults to wx.DefaultPosition.
size – The size of the window. Defaults to wx.DefaultSize.
style – The style of the WX Frame. Look at wx.Frame docs for supported styles.
name – The WX internal name of the window.
Methods
__init__(parent, video_hdl, poses, names, ...)Construct a new FBEditor UI.
on_tool(evt)PRIVATE: Triggered whenever a tool is clicked on in the toolbar....
set_fb_runner(func)Set the Forward/Backward runner function, which runs FB on the entire dataset.
set_frame_exporter(func)Set the frame exporting function, which exports current modified frames UI is showing...
Set the plot settings changing function, which allows for adjusting certain video metadata values when they become adjusted.
set_radiobox_colors(colormap)Attributes
HIST_IDENTITY_SWAPHIST_POSE_CHANGEPLOT_SETTINGS_MAPPINGSEPERATORTOOLBAR_ICON_SIZEGet the history object of this FB Editor, allows the user to add there own custom history events, and also manipulate this history.
Get the score engine displays.
- _build_toolbar(manual_save: Callable | None, heatmap_entries: List[str] | None, debug: bool = False)[source]¶
PRIVATE: Constructs the toolbar, adds all tools to the toolbar, and sets up toolbar events to trigger actions within the UI.
- _launch_help()[source]¶
PRIVATE: Launches the help dialog for the FBEditor, which describes how to use the UI and lists all tools and keyboard shortcuts.
- _on_spin(evt: wx.SpinEvent)[source]¶
PRIVATE: Triggered when the value in the wx.SpinStrl in the toolbar is changed by the user.
- _pose_doer(pose_data)[source]¶
- PRIVATE: Handles pose undo and redo events via the history doer api. Accepts an older/newer state, applies it,
and returns the current state.
- _refocus(evt)[source]¶
PRIVATE: Refocuses the FBEditor window for accepting keyboard events. Used after disabling all controls during a point edit event.
- property history: History¶
Get the history object of this FB Editor, allows the user to add there own custom history events, and also manipulate this history.
- on_tool(evt: wx.CommandEvent)[source]¶
PRIVATE: Triggered whenever a tool is clicked on in the toolbar….
- property score_displays¶
Get the score engine displays.
- Returns:
A list of ScoreEngineDisplayer, being all the probability displays of this editor window.
- set_fb_runner(func: Callable[[], bool] | None)[source]¶
Set the Forward/Backward runner function, which runs FB on the entire dataset.
- Parameters:
func – A callable which accepts no arguments, and return a boolean determining if the history should be cleared. It is assumed this method already has access to all data to rerun FB on the data, and it is also assumed this function will manipulate the widgets of the FB Editor to have the updated data. (Specifically the score_displays, and the video_player.video_viewer).
- set_frame_exporter(func: Callable[[int, str, Path], Tuple[bool, str]] | None)[source]¶
Set the frame exporting function, which exports current modified frames UI is showing…
- Parameters:
func – The function to handle frame exporting. It will be passed an integer being the type of frames to export (0 for pre frame passes and 1 for post frame passes), a string being the format to save the file to (‘DLFS’ or ‘HDF5’) and a Path to where the user selected to save the frames, and is expected to return a boolean being if the export succeeded and a string being the error message displayed if it did not.
- set_plot_settings_changer(func: Callable[[Mapping[str, Any]], None] | None)[source]¶
Set the plot settings changing function, which allows for adjusting certain video metadata values when they become adjusted.
- Parameters:
func – Optional function that accepts a string to any mapping (dict), and returns nothing. Can be used for adjusting video metadata when a user adjusts visual settings in the UI.