Mask

class tools.manual.frame_viewer.editor.mask.Mask(canvas: tk.Canvas, detected_faces: detected_faces.DetectedFaces)

Bases: Editor

The mask Editor.

Edit a mask in the alignments file.

Parameters:
  • canvas (tk.Canvas) – The canvas that holds the image and annotations

  • detected_faces (detected_faces.DetectedFaces) – The _detected_faces data for this manual session

Attributes Summary

actions

The optional action buttons for the actions frame in the GUI for the current editor

controls

The control panel options and header text for the current editor

view_mode

The view mode for the currently selected editor.

Methods Summary

bind_mouse_motion()

Binds the mouse motion for the current editor's mouse <Motion> event to the editor's _update_cursor() function.

hide_annotation([tag])

Clear the mask _meta dict when hiding the annotation.

scale_from_display(points[, do_offset])

Scale and offset the given points from the current display to the correct original values.

set_mouse_click_actions()

Add the bindings for left mouse button click and drag actions.

update_annotation()

Update the mask annotation with the latest mask.

Attributes Documentation

actions

The optional action buttons for the actions frame in the GUI for the current editor

Type:

list

controls

The control panel options and header text for the current editor

Type:

dict

view_mode

The view mode for the currently selected editor. If the editor does not have a view mode that can be updated, then “frame” will be returned.

Type:

[“frame”, “face”]

Methods Documentation

bind_mouse_motion()

Binds the mouse motion for the current editor’s mouse <Motion> event to the editor’s _update_cursor() function.

Called on initialization and active editor update.

hide_annotation(tag=None) None

Clear the mask _meta dict when hiding the annotation.

Return type:

None

scale_from_display(points, do_offset=True)

Scale and offset the given points from the current display to the correct original values.

Parameters:
  • points (numpy.ndarray) – Array of x, y co-ordinates to adjust

  • offset (bool, optional) – True if the offset should be calculated otherwise False. Default: True

Returns:

The adjusted x, y co-ordinates to the original frame location rounded to the nearest integer

Return type:

numpy.ndarray

set_mouse_click_actions()

Add the bindings for left mouse button click and drag actions.

This binds the mouse to the _drag_start(), _drag() and _drag_stop() methods.

By default these methods do nothing (except for _drag_stop() which resets _drag_data.

This bindings should be added for all editors. To add additional bindings, super().set_mouse_click_actions should be called prior to adding them..

update_annotation() None

Update the mask annotation with the latest mask.

Return type:

None

hide_annotation(tag=None) None

Clear the mask _meta dict when hiding the annotation.

Return type:

None

update_annotation() None

Update the mask annotation with the latest mask.

Return type:

None