Skip to content

Commit aa066ad

Browse files
committed
bugfix: Aligned faces. Fix padding calculation
1 parent f403afb commit aa066ad

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

lib/align/aligned_face.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,8 @@ def _padding_from_coverage(cls, size: int, coverage_ratio: float) -> dict[Center
335335
-------
336336
The padding required, in pixels for 'head', 'face' and 'legacy' face types
337337
"""
338-
retval = {_type: round((size * (1 - EXTRACT_RATIOS[_type] / coverage_ratio)) / 2)
338+
retval = {_type: round(size * (EXTRACT_RATIOS[_type] + coverage_ratio - 1) /
339+
(2 * coverage_ratio))
339340
for _type in T.get_args(T.Literal["legacy", "face", "head"])}
340341
logger.trace(retval) # type:ignore[attr-defined]
341342
return retval

tools/alignments/media.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,6 @@ def __init__(self, frames: Frames, alignments: AlignmentData, size: int = 512) -
481481
logger.trace("Initializing %s: size: %s", # type:ignore[attr-defined]
482482
self.__class__.__name__, size)
483483
self.size = size
484-
self.padding = int(size * 0.1875)
485484
self.alignments = alignments
486485
self.frames = frames
487486
self.current_frame: str | None = None

0 commit comments

Comments
 (0)