Kims12 commited on
Commit
8621860
1 Parent(s): 24cb82a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
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
- warm_image = cv2.applyColorMap(image, cv2.COLORMAP_AUTUMN)
 
39
  return warm_image
40
  elif filter_type == "Cold Tone":
41
- cold_image = cv2.applyColorMap(image, cv2.COLORMAP_WINTER)
 
42
  return cold_image
43
  elif filter_type == "High-Key":
44
- high_key = cv2.convertScaleAbs(image, alpha=1.0 + 0.8 * normalized_intensity, beta=30)
 
45
  return high_key
46
  elif filter_type == "Low-Key":
47
- low_key = cv2.convertScaleAbs(image, alpha=1.0 - 0.7 * normalized_intensity, beta=-30)
 
48
  return low_key
49
  elif filter_type == "Haze":
50
- haze = cv2.addWeighted(image, 1.0 - 0.7 * normalized_intensity, np.full(image.shape, 255, dtype=np.uint8), 0.3 * normalized_intensity, 0)
 
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