TKFace

class tools.manual.face_viewer.viewport.TKFace(face: ndarray, size: int = 128, mask: ndarray | None = None)

Bases: object

An object that holds a single tkinter.PhotoImage face, ready for placement in the Viewport, Handles the placement of and removal of masks for the face as well as updates on any edits.

Parameters:
  • face (numpy.ndarray) – The face, sized correctly as a 3 channel BGR image or an encoded jpg to create a tkinter.PhotoImage from

  • size (int, optional) – The pixel size of the face image. Default: 128

  • mask (numpy.ndarray or None, optional) – The mask to be applied to the face image. Pass None if no mask is to be used. Default None

Attributes Summary

photo

The face in a format that can be placed on the FacesViewer canvas.

Methods Summary

update(face, mask)

Update the photo with the given face and mask.

update_mask(mask)

Update the mask in the 4th channel of photo to the given mask.

Attributes Documentation

photo

The face in a format that can be placed on the FacesViewer canvas.

Type:

PIL.ImageTk.PhotoImage

Methods Documentation

update(face: ndarray, mask: ndarray) None

Update the photo with the given face and mask.

Parameters:
  • face (numpy.ndarray) – The face, sized correctly as a 3 channel BGR image

  • mask (numpy.ndarray or None) – The mask to be applied to the face image. Pass None if no mask is to be used

Return type:

None

update_mask(mask: ndarray | None) None

Update the mask in the 4th channel of photo to the given mask.

Parameters:

mask (numpy.ndarray or None) – The mask to be applied to the face image. Pass None if no mask is to be used

Return type:

None

property photo: PhotoImage

The face in a format that can be placed on the FacesViewer canvas.

Type:

PIL.ImageTk.PhotoImage

update(face: ndarray, mask: ndarray) None

Update the photo with the given face and mask.

Parameters:
  • face (numpy.ndarray) – The face, sized correctly as a 3 channel BGR image

  • mask (numpy.ndarray or None) – The mask to be applied to the face image. Pass None if no mask is to be used

Return type:

None

update_mask(mask: ndarray | None) None

Update the mask in the 4th channel of photo to the given mask.

Parameters:

mask (numpy.ndarray or None) – The mask to be applied to the face image. Pass None if no mask is to be used

Return type:

None