FaceUpdate
- class tools.manual.detected_faces.FaceUpdate(detected_faces: DetectedFaces)
Bases:
objectPerform updates on
DetectedFaceobjects stored inDetectedFaceswhen changes are made within the GUI.- Parameters:
detected_faces (DetectedFaces) – The parent
DetectedFacesobject
Methods Summary
add(frame_index, pnt_x, width, pnt_y, height)Add a
DetectedFaceobject to the current frame with the given dimensions.bounding_box(frame_index, face_index, pnt_x, ...)Update the bounding box for the
DetectedFaceobject at the given frame and face indices, with the given dimensions and update the 68 point landmarks from theAlignerfor the updated bounding box.copy(frame_index, direction)Copy the alignments from the previous or next frame that has alignments to the current frame.
delete(frame_index, face_index)Delete the
DetectedFaceobject for the given frame and face indices.landmark(frame_index, face_index, ...)Shift a single landmark point for the
DetectedFaceobject at the given frame and face indices by the given x and y values.landmarks(frame_index, face_index, shift_x, ...)Shift all of the landmarks and bounding box for the
DetectedFaceobject at the given frame and face indices by the given x and y values and update the masks.landmarks_rotate(frame_index, face_index, ...)Rotate the landmarks on an Extract Box rotate for the
DetectedFaceobject at the given frame and face indices for the given angle from the given center point.landmarks_scale(frame_index, face_index, ...)Scale the landmarks on an Extract Box resize for the
DetectedFaceobject at the given frame and face indices from the given center point.mask(frame_index, face_index, mask, mask_type)Update the mask on an edit for the
DetectedFaceobject at the given frame and face indices, for the given mask and mask type.post_edit_trigger(frame_index, face_index)Update the jpg thumbnail, the viewport thumbnail, the landmark masks and the aligned face on a face edit.
Methods Documentation
- add(frame_index: int, pnt_x: int, width: int, pnt_y: int, height: int) None
Add a
DetectedFaceobject to the current frame with the given dimensions.- Parameters:
frame_index (int) – The frame that the face is being set for
pnt_x (int) – The left point of the bounding box
width (int) – The width of the bounding box
pnt_y (int) – The top point of the bounding box
height (int) – The height of the bounding box
- Return type:
None
- bounding_box(frame_index: int, face_index: int, pnt_x: int, width: int, pnt_y: int, height: int, aligner: Literal['FAN', 'HRNet', 'cv2-dnn'] = 'HRNet') None
Update the bounding box for the
DetectedFaceobject at the given frame and face indices, with the given dimensions and update the 68 point landmarks from theAlignerfor the updated bounding box.- Parameters:
frame_index (int) – The frame that the face is being set for
face_index (int) – The face index within the frame
pnt_x (int) – The left point of the bounding box
width (int) – The width of the bounding box
pnt_y (int) – The top point of the bounding box
height (int) – The height of the bounding box
aligner (Literal['FAN', 'HRNet', 'cv2-dnn']) – The aligner to use to generate the landmarks. Default: “HRNet”
- Return type:
None
- copy(frame_index: int, direction: Literal['prev', 'next']) None
Copy the alignments from the previous or next frame that has alignments to the current frame.
- Parameters:
frame_index (int) – The frame that the needs to have alignments copied to it
direction (Literal['prev', 'next']) – Whether to copy alignments from the previous frame with alignments, or the next frame with alignments
- Return type:
None
- delete(frame_index: int, face_index: int) None
Delete the
DetectedFaceobject for the given frame and face indices.- Parameters:
frame_index (int) – The frame that the face is being set for
face_index (int) – The face index within the frame
- Return type:
None
- landmark(frame_index: int, face_index: int, landmark_index: int, shift_x: int, shift_y: int, is_zoomed: bool) None
Shift a single landmark point for the
DetectedFaceobject at the given frame and face indices by the given x and y values.- Parameters:
frame_index (int) – The frame that the face is being set for
face_index (int) – The face index within the frame
landmark_index (int) – The landmark index to shift. If a list is provided, this should be a list of landmark indices to be shifted
shift_x (int) – The amount to shift the landmark by along the x axis
shift_y (int) – The amount to shift the landmark by along the y axis
is_zoomed (bool) –
Trueif landmarks are being adjusted on a zoomed image otherwiseFalse
- Return type:
None
- landmarks(frame_index: int, face_index: int, shift_x: int, shift_y: int) None
Shift all of the landmarks and bounding box for the
DetectedFaceobject at the given frame and face indices by the given x and y values and update the masks.- Parameters:
frame_index (int) – The frame that the face is being set for
face_index (int) – The face index within the frame
shift_x (int) – The amount to shift the landmarks by along the x axis
shift_y (int) – The amount to shift the landmarks by along the y axis
- Return type:
None
Notes
Whilst the bounding box does not need to be shifted, it is anyway, to ensure that it is aligned with the newly adjusted landmarks.
- landmarks_rotate(frame_index: int, face_index: int, angle: float, center: ndarray) None
Rotate the landmarks on an Extract Box rotate for the
DetectedFaceobject at the given frame and face indices for the given angle from the given center point.- Parameters:
frame_index (int) – The frame that the face is being set for
face_index (int) – The face index within the frame
angle (float) – The angle, in radians to rotate the points by
center (ndarray) – The center point of the Landmark’s Extract Box
- Return type:
None
- landmarks_scale(frame_index: int, face_index: int, scale: ndarray, center: ndarray) None
Scale the landmarks on an Extract Box resize for the
DetectedFaceobject at the given frame and face indices from the given center point.- Parameters:
frame_index (int) – The frame that the face is being set for
face_index (int) – The face index within the frame
scale (ndarray) – The amount to scale the landmarks by
center (ndarray) – The center point of the Landmark’s Extract Box
- Return type:
None
- mask(frame_index: int, face_index: int, mask: ndarray, mask_type: str) None
Update the mask on an edit for the
DetectedFaceobject at the given frame and face indices, for the given mask and mask type.- Parameters:
frame_index (int) – The frame that the face is being set for
face_index (int) – The face index within the frame
mask (ndarray) – The mask to replace
mask_type (str) – The name of the mask that is to be replaced
- Return type:
None
- post_edit_trigger(frame_index: int, face_index: int) None
Update the jpg thumbnail, the viewport thumbnail, the landmark masks and the aligned face on a face edit.
- Parameters:
frame_index (int) – The frame that the face is being set for
face_index (int) – The face index within the frame
- Return type:
None
- add(frame_index: int, pnt_x: int, width: int, pnt_y: int, height: int) None
Add a
DetectedFaceobject to the current frame with the given dimensions.- Parameters:
frame_index (int) – The frame that the face is being set for
pnt_x (int) – The left point of the bounding box
width (int) – The width of the bounding box
pnt_y (int) – The top point of the bounding box
height (int) – The height of the bounding box
- Return type:
None
- bounding_box(frame_index: int, face_index: int, pnt_x: int, width: int, pnt_y: int, height: int, aligner: Literal['FAN', 'HRNet', 'cv2-dnn'] = 'HRNet') None
Update the bounding box for the
DetectedFaceobject at the given frame and face indices, with the given dimensions and update the 68 point landmarks from theAlignerfor the updated bounding box.- Parameters:
frame_index (int) – The frame that the face is being set for
face_index (int) – The face index within the frame
pnt_x (int) – The left point of the bounding box
width (int) – The width of the bounding box
pnt_y (int) – The top point of the bounding box
height (int) – The height of the bounding box
aligner (Literal['FAN', 'HRNet', 'cv2-dnn']) – The aligner to use to generate the landmarks. Default: “HRNet”
- Return type:
None
- copy(frame_index: int, direction: Literal['prev', 'next']) None
Copy the alignments from the previous or next frame that has alignments to the current frame.
- Parameters:
frame_index (int) – The frame that the needs to have alignments copied to it
direction (Literal['prev', 'next']) – Whether to copy alignments from the previous frame with alignments, or the next frame with alignments
- Return type:
None
- delete(frame_index: int, face_index: int) None
Delete the
DetectedFaceobject for the given frame and face indices.- Parameters:
frame_index (int) – The frame that the face is being set for
face_index (int) – The face index within the frame
- Return type:
None
- landmark(frame_index: int, face_index: int, landmark_index: int, shift_x: int, shift_y: int, is_zoomed: bool) None
Shift a single landmark point for the
DetectedFaceobject at the given frame and face indices by the given x and y values.- Parameters:
frame_index (int) – The frame that the face is being set for
face_index (int) – The face index within the frame
landmark_index (int) – The landmark index to shift. If a list is provided, this should be a list of landmark indices to be shifted
shift_x (int) – The amount to shift the landmark by along the x axis
shift_y (int) – The amount to shift the landmark by along the y axis
is_zoomed (bool) –
Trueif landmarks are being adjusted on a zoomed image otherwiseFalse
- Return type:
None
- landmarks(frame_index: int, face_index: int, shift_x: int, shift_y: int) None
Shift all of the landmarks and bounding box for the
DetectedFaceobject at the given frame and face indices by the given x and y values and update the masks.- Parameters:
frame_index (int) – The frame that the face is being set for
face_index (int) – The face index within the frame
shift_x (int) – The amount to shift the landmarks by along the x axis
shift_y (int) – The amount to shift the landmarks by along the y axis
- Return type:
None
Notes
Whilst the bounding box does not need to be shifted, it is anyway, to ensure that it is aligned with the newly adjusted landmarks.
- landmarks_rotate(frame_index: int, face_index: int, angle: float, center: ndarray) None
Rotate the landmarks on an Extract Box rotate for the
DetectedFaceobject at the given frame and face indices for the given angle from the given center point.- Parameters:
frame_index (int) – The frame that the face is being set for
face_index (int) – The face index within the frame
angle (float) – The angle, in radians to rotate the points by
center (ndarray) – The center point of the Landmark’s Extract Box
- Return type:
None
- landmarks_scale(frame_index: int, face_index: int, scale: ndarray, center: ndarray) None
Scale the landmarks on an Extract Box resize for the
DetectedFaceobject at the given frame and face indices from the given center point.- Parameters:
frame_index (int) – The frame that the face is being set for
face_index (int) – The face index within the frame
scale (ndarray) – The amount to scale the landmarks by
center (ndarray) – The center point of the Landmark’s Extract Box
- Return type:
None
- mask(frame_index: int, face_index: int, mask: ndarray, mask_type: str) None
Update the mask on an edit for the
DetectedFaceobject at the given frame and face indices, for the given mask and mask type.- Parameters:
frame_index (int) – The frame that the face is being set for
face_index (int) – The face index within the frame
mask (ndarray) – The mask to replace
mask_type (str) – The name of the mask that is to be replaced
- Return type:
None
- post_edit_trigger(frame_index: int, face_index: int) None
Update the jpg thumbnail, the viewport thumbnail, the landmark masks and the aligned face on a face edit.
- Parameters:
frame_index (int) – The frame that the face is being set for
face_index (int) – The face index within the frame
- Return type:
None