Scaling
- class plugins.convert.scaling.sharpen.Scaling(config_file=None)
Bases:
AdjustmentSharpening Adjustments for the face applied after warp to final frame
Methods Summary
box(new_face, kernel_size, radius, amount)Sharpen using box filter
gaussian(new_face, kernel_size, radius, amount)Sharpen using gaussian filter
get_kernel_size(new_face, radius_percent)Return the kernel size and central point for the given radius
process(new_face)Sharpen using the requested technique
run(new_face)Perform selected adjustment on face
unsharp_mask(new_face, kernel_size, center, ...)Sharpen using unsharp mask
Methods Documentation
- classmethod box(new_face: ndarray, kernel_size: tuple[int, int], radius: int, amount: float) ndarray
Sharpen using box filter
- Parameters:
new_face (
numpy.ndarray) – The batch of swapped image patches that is to have sharpening appliedkernel_size (tuple[int, int]) – The sharpening kernel size
radius (int) – The pixel radius the kernel
amount (float) – The amount of sharpening to apply
- Returns:
The batch of swapped faces with box sharpening applied
- Return type:
numpy.ndarray
- classmethod gaussian(new_face: ndarray, kernel_size: tuple[int, int], radius: float, amount: float) ndarray
Sharpen using gaussian filter
- Parameters:
new_face (
numpy.ndarray) – The batch of swapped image patches that is to have sharpening appliedkernel_size (tuple[int, int]) – The sharpening kernel size
radius (int) – The pixel radius the kernel. Unused
amount (float) – The amount of sharpening to apply
- Returns:
The batch of swapped faces with gaussian sharpening applied
- Return type:
numpy.ndarray
- classmethod get_kernel_size(new_face: ndarray, radius_percent: float) tuple[tuple[int, int], int]
- Return the kernel size and central point for the given radius
relative to frame width.
- Parameters:
new_face (
numpy.ndarray) – The swapped image patch that is to have sharpening appliedradius_percent (float) – The percentage of the image size to use as the sharpening kernel
- Returns:
kernel_size (tuple[int, int]) – The sharpening kernel
radius (int) – The pixel radius the kernel
- Return type:
tuple[tuple[int, int], int]
- process(new_face: ndarray) ndarray
Sharpen using the requested technique
- Parameters:
new_face (
numpy.ndarray) – A batch of swapped image patch that is to have sharpening applied- Returns:
The batch of swapped faces with sharpening applied
- Return type:
numpy.ndarray
- run(new_face)
Perform selected adjustment on face
- classmethod unsharp_mask(new_face: ndarray, kernel_size: tuple[int, int], center: float, amount: float) ndarray
Sharpen using unsharp mask
- Parameters:
new_face (
numpy.ndarray) – The batch of swapped image patches that is to have sharpening appliedkernel_size (tuple[int, int]) – The sharpening kernel size
radius (int) – The pixel radius the kernel. Unused
amount (float) – The amount of sharpening to apply
center (float)
- Returns:
The batch of swapped faces with unsharp-mask sharpening applied
- Return type:
numpy.ndarray
- classmethod box(new_face: ndarray, kernel_size: tuple[int, int], radius: int, amount: float) ndarray
Sharpen using box filter
- Parameters:
new_face (
numpy.ndarray) – The batch of swapped image patches that is to have sharpening appliedkernel_size (tuple[int, int]) – The sharpening kernel size
radius (int) – The pixel radius the kernel
amount (float) – The amount of sharpening to apply
- Returns:
The batch of swapped faces with box sharpening applied
- Return type:
numpy.ndarray
- classmethod gaussian(new_face: ndarray, kernel_size: tuple[int, int], radius: float, amount: float) ndarray
Sharpen using gaussian filter
- Parameters:
new_face (
numpy.ndarray) – The batch of swapped image patches that is to have sharpening appliedkernel_size (tuple[int, int]) – The sharpening kernel size
radius (int) – The pixel radius the kernel. Unused
amount (float) – The amount of sharpening to apply
- Returns:
The batch of swapped faces with gaussian sharpening applied
- Return type:
numpy.ndarray
- classmethod get_kernel_size(new_face: ndarray, radius_percent: float) tuple[tuple[int, int], int]
- Return the kernel size and central point for the given radius
relative to frame width.
- Parameters:
new_face (
numpy.ndarray) – The swapped image patch that is to have sharpening appliedradius_percent (float) – The percentage of the image size to use as the sharpening kernel
- Returns:
kernel_size (tuple[int, int]) – The sharpening kernel
radius (int) – The pixel radius the kernel
- Return type:
tuple[tuple[int, int], int]
- process(new_face: ndarray) ndarray
Sharpen using the requested technique
- Parameters:
new_face (
numpy.ndarray) – A batch of swapped image patch that is to have sharpening applied- Returns:
The batch of swapped faces with sharpening applied
- Return type:
numpy.ndarray
- classmethod unsharp_mask(new_face: ndarray, kernel_size: tuple[int, int], center: float, amount: float) ndarray
Sharpen using unsharp mask
- Parameters:
new_face (
numpy.ndarray) – The batch of swapped image patches that is to have sharpening appliedkernel_size (tuple[int, int]) – The sharpening kernel size
radius (int) – The pixel radius the kernel. Unused
amount (float) – The amount of sharpening to apply
center (float)
- Returns:
The batch of swapped faces with unsharp-mask sharpening applied
- Return type:
numpy.ndarray