Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions deforum_flux/helpers/generate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Standard library imports
import os

# Related third-party imports
import torch
import numpy as np
from PIL import Image
Expand All @@ -20,7 +16,6 @@
from glob import iglob
from io import BytesIO

import torch
from dataclasses import dataclass

from einops import rearrange
Expand Down
3 changes: 1 addition & 2 deletions deforum_flux/helpers/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ def unsharp_mask(img, kernel_size=(5, 5), sigma=1.0, amount=1.0, threshold=0):
"""Return a sharpened version of the image, using an unsharp mask."""
blurred = cv2.GaussianBlur(img, kernel_size, sigma)
sharpened = float(amount + 1) * img - float(amount) * blurred
sharpened = np.maximum(sharpened, np.zeros(sharpened.shape))
sharpened = np.minimum(sharpened, 255 * np.ones(sharpened.shape))
sharpened = sharpened.clip(0, 255)
sharpened = sharpened.round().astype(np.uint8)
if threshold > 0:
low_contrast_mask = np.absolute(img - blurred) < threshold
Expand Down