Update app.py
Browse files
app.py
CHANGED
@@ -35,19 +35,24 @@ def apply_filter(image, filter_type, intensity):
|
|
35 |
enhanced_image = np.array(image_pil)
|
36 |
return enhanced_image
|
37 |
elif filter_type == "Warm Tone":
|
38 |
-
|
|
|
39 |
return warm_image
|
40 |
elif filter_type == "Cold Tone":
|
41 |
-
|
|
|
42 |
return cold_image
|
43 |
elif filter_type == "High-Key":
|
44 |
-
|
|
|
45 |
return high_key
|
46 |
elif filter_type == "Low-Key":
|
47 |
-
|
|
|
48 |
return low_key
|
49 |
elif filter_type == "Haze":
|
50 |
-
|
|
|
51 |
return haze
|
52 |
else:
|
53 |
return image
|
|
|
35 |
enhanced_image = np.array(image_pil)
|
36 |
return enhanced_image
|
37 |
elif filter_type == "Warm Tone":
|
38 |
+
# 강도를 30%로 설정
|
39 |
+
warm_image = cv2.addWeighted(image, 1.0, np.full(image.shape, (30, 10, 0), dtype=np.uint8), 0.3 * normalized_intensity, 0)
|
40 |
return warm_image
|
41 |
elif filter_type == "Cold Tone":
|
42 |
+
# 강도를 30%로 설정
|
43 |
+
cold_image = cv2.addWeighted(image, 1.0, np.full(image.shape, (0, 0, 40), dtype=np.uint8), 0.3 * normalized_intensity, 0)
|
44 |
return cold_image
|
45 |
elif filter_type == "High-Key":
|
46 |
+
# 강도를 30%로 설정
|
47 |
+
high_key = cv2.convertScaleAbs(image, alpha=1.0 + 0.3 * normalized_intensity, beta=20)
|
48 |
return high_key
|
49 |
elif filter_type == "Low-Key":
|
50 |
+
# 강도를 30%로 설정
|
51 |
+
low_key = cv2.convertScaleAbs(image, alpha=1.0 - 0.3 * normalized_intensity, beta=-20)
|
52 |
return low_key
|
53 |
elif filter_type == "Haze":
|
54 |
+
# 강도를 30%로 설정
|
55 |
+
haze = cv2.addWeighted(image, 1.0, np.full(image.shape, 255, dtype=np.uint8), 0.3 * normalized_intensity, 0)
|
56 |
return haze
|
57 |
else:
|
58 |
return image
|