Kims12 commited on
Commit
42691c3
ยท
verified ยท
1 Parent(s): 6e53669

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -13,10 +13,16 @@ def apply_filter(image, filter_type, intensity):
13
  soft_glow = cv2.addWeighted(image, 1 - normalized_intensity, gaussian, normalized_intensity, 0)
14
  return soft_glow
15
  elif filter_type == "Portrait Enhancer":
16
- # ๊ฐ„๋‹จํ•œ ํฌํŠธ๋ ˆ์ดํŠธ ํ–ฅ์ƒ (๋ถ€๋“œ๋Ÿฝ๊ฒŒ ์กฐ์ •๋œ ๋Œ€๋น„ ๋ฐ ๋ฐ๊ธฐ)
17
- enhanced = cv2.detailEnhance(image, sigma_s=5, sigma_r=0.05 + 0.1 * normalized_intensity)
18
- # ํ”ผ๋ถ€ ๋ถ€๋“œ๋Ÿฝ๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•ด ์ถ”๊ฐ€์ ์ธ ๋ธ”๋Ÿฌ ์ ์šฉ
19
- smoothed = cv2.bilateralFilter(enhanced, d=9, sigmaColor=75, sigmaSpace=75)
 
 
 
 
 
 
20
  return smoothed
21
  elif filter_type == "Warm Tone":
22
  increase_red = np.array([[1.0 + 0.2 * normalized_intensity, 0.0, 0.0],
 
13
  soft_glow = cv2.addWeighted(image, 1 - normalized_intensity, gaussian, normalized_intensity, 0)
14
  return soft_glow
15
  elif filter_type == "Portrait Enhancer":
16
+ # ๋ถ€๋“œ๋Ÿฌ์šด ํ”ผ๋ถ€ ํ‘œํ˜„์„ ์œ„ํ•œ ํ•„ํ„ฐ ์กฐํ•ฉ
17
+ # Step 1: Detail Enhance ์‚ฌ์šฉ ์ตœ์†Œํ™”
18
+ enhanced = cv2.detailEnhance(image, sigma_s=5, sigma_r=0.05 + 0.05 * normalized_intensity)
19
+
20
+ # Step 2: Gaussian Blur ์ ์šฉ (์ ๋‹นํ•œ ๊ฐ•๋„๋กœ)
21
+ blurred = cv2.GaussianBlur(enhanced, (15, 15), 0)
22
+
23
+ # Step 3: Bilateral Filter ์ ์šฉ (๊ฒฝ๊ณ„ ๋ณด์กดํ•˜๋ฉด์„œ ๋ถ€๋“œ๋Ÿฝ๊ฒŒ)
24
+ smoothed = cv2.bilateralFilter(blurred, d=9, sigmaColor=75, sigmaSpace=75)
25
+
26
  return smoothed
27
  elif filter_type == "Warm Tone":
28
  increase_red = np.array([[1.0 + 0.2 * normalized_intensity, 0.0, 0.0],