Update app.py
Browse files
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 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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],
|