Kims12 commited on
Commit
50a5493
·
verified ·
1 Parent(s): 58f5984

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -16,12 +16,18 @@ def apply_filter(image, filter_type):
16
  enhanced = cv2.detailEnhance(image, sigma_s=10, sigma_r=0.15)
17
  return enhanced
18
  elif filter_type == "Warm Tone":
19
- # 따뜻한 톤 효과
20
- warm_image = cv2.applyColorMap(image, cv2.COLORMAP_AUTUMN)
 
 
 
21
  return warm_image
22
  elif filter_type == "Cold Tone":
23
- # 차가운 톤 효과
24
- cold_image = cv2.applyColorMap(image, cv2.COLORMAP_WINTER)
 
 
 
25
  return cold_image
26
  elif filter_type == "High-Key":
27
  # High-Key 효과 (밝기 증가)
@@ -36,7 +42,6 @@ def apply_filter(image, filter_type):
36
  haze = cv2.addWeighted(image, 0.7, np.full(image.shape, 255, dtype=np.uint8), 0.3, 0)
37
  return haze
38
  else:
39
- # 필터를 적용하지 않음
40
  return image
41
 
42
  def convert_to_grayscale(image):
@@ -58,7 +63,7 @@ iface = gr.Interface(
58
  inputs=[
59
  "image",
60
  gr.Radio(
61
- ["None", "Grayscale", "Soft Glow", "Portrait Enhancer", "Warm Tone", "Cold Tone", "High-Key", "Low-Key", "Haze"],
62
  label="필터 선택"
63
  )
64
  ],
 
16
  enhanced = cv2.detailEnhance(image, sigma_s=10, sigma_r=0.15)
17
  return enhanced
18
  elif filter_type == "Warm Tone":
19
+ # 따뜻한 톤 효과 (빨강 및 노랑 톤을 강조)
20
+ increase_red = np.array([[1.2, 0.0, 0.0],
21
+ [0.0, 1.0, 0.0],
22
+ [0.0, 0.0, 0.8]])
23
+ warm_image = cv2.transform(image, increase_red)
24
  return warm_image
25
  elif filter_type == "Cold Tone":
26
+ # 차가운 톤 효과 (파랑 톤을 강조)
27
+ increase_blue = np.array([[0.8, 0.0, 0.0],
28
+ [0.0, 1.0, 0.0],
29
+ [0.0, 0.0, 1.2]])
30
+ cold_image = cv2.transform(image, increase_blue)
31
  return cold_image
32
  elif filter_type == "High-Key":
33
  # High-Key 효과 (밝기 증가)
 
42
  haze = cv2.addWeighted(image, 0.7, np.full(image.shape, 255, dtype=np.uint8), 0.3, 0)
43
  return haze
44
  else:
 
45
  return image
46
 
47
  def convert_to_grayscale(image):
 
63
  inputs=[
64
  "image",
65
  gr.Radio(
66
+ ["Grayscale", "Soft Glow", "Portrait Enhancer", "Warm Tone", "Cold Tone", "High-Key", "Low-Key", "Haze"],
67
  label="필터 선택"
68
  )
69
  ],