Mesh

class tools.manual.frame_viewer.editor.landmarks.Mesh(canvas, detected_faces)

Bases: Editor

The Landmarks Mesh Display.

There are no editing options for Mesh editor. It is purely aesthetic and updated when other editors are used.

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

  • 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])

Hide annotations for this editor.

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()

Get the latest Landmarks and update the mesh.

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)

Hide annotations for this editor.

Parameters:

tag (str, optional) – The specific tag to hide annotations for. If None then all annotations for this editor are hidden, otherwise only the annotations specified by the given tag are hidden. Default: 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()

Get the latest Landmarks and update the mesh.

update_annotation()

Get the latest Landmarks and update the mesh.