Skip to content

Commit

Permalink
fix bug of image_beauty
Browse files Browse the repository at this point in the history
  • Loading branch information
chflame163 committed Jan 15, 2025
1 parent f8439eb commit 84d357a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions py/imagefunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1264,8 +1264,8 @@ def image_beauty(image:Image, level:int=50) -> Image:
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
factor = (level / 50.0)**2
d = int((image.width + image.height) / 256 * factor)
sigmaColor = int((image.width + image.height) / 256 * factor)
sigmaSpace = int((image.width + image.height) / 160 * factor)
sigmaColor = max(1, float((image.width + image.height) / 256 * factor))
sigmaSpace = max(1, float((image.width + image.height) / 160 * factor))
img_bit = cv2.bilateralFilter(src=img, d=d, sigmaColor=sigmaColor, sigmaSpace=sigmaSpace)
ret_image = cv2.cvtColor(img_bit, cv2.COLOR_BGR2RGB)
return cv22pil(ret_image)
Expand Down

0 comments on commit 84d357a

Please sign in to comment.