DigiP-AI commited on
Commit
0e82c5e
·
verified ·
1 Parent(s): d1c2160

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -52,23 +52,23 @@ def classic_filter(image, filter_type):
52
  edges = cv2.Canny(image, 100, 200)
53
  return cv2.cvtColor(edges, cv2.COLOR_GRAY2BGR)
54
 
55
- def createer_filter(image, filter_type):
56
  """Creative and unusual image filters"""
57
  if filter_type == "Pixel Art":
58
  h, w = image.shape[:2]
59
- piksel_size = 20
60
- small = cv2.resize(image, (w//piksel_size, h//piksel_size))
61
  return cv2.resize(small, (w, h), interpolation=cv2.INTER_NEAREST)
62
 
63
  elif filter_type == "Mosaic Effect":
64
  h, w = image.shape[:2]
65
- mozaik_size = 30
66
- for i in range(0, h, mozaik_size):
67
- for j in range(0, w, mozaik_size):
68
- roi = image[i:i+mozaik_size, j:j+mozaik_size]
69
  if roi.size > 0:
70
  color = np.mean(roi, axis=(0,1))
71
- image[i:i+mozaik_size, j:j+mozaik_size] = color
72
  return image
73
 
74
  elif filter_type == "Rainbow":
 
52
  edges = cv2.Canny(image, 100, 200)
53
  return cv2.cvtColor(edges, cv2.COLOR_GRAY2BGR)
54
 
55
+ def creative_filter(image, filter_type):
56
  """Creative and unusual image filters"""
57
  if filter_type == "Pixel Art":
58
  h, w = image.shape[:2]
59
+ pixsel_size = 20
60
+ small = cv2.resize(image, (w//piksel_size, h//pixsel_size))
61
  return cv2.resize(small, (w, h), interpolation=cv2.INTER_NEAREST)
62
 
63
  elif filter_type == "Mosaic Effect":
64
  h, w = image.shape[:2]
65
+ mosaic_size = 30
66
+ for i in range(0, h, mosaic_size):
67
+ for j in range(0, w, mosaic_size):
68
+ roi = image[i:i+mosaic_size, j:j+mosaic_size]
69
  if roi.size > 0:
70
  color = np.mean(roi, axis=(0,1))
71
+ image[i:i+mosaic_size, j:j+mosaic_size] = color
72
  return image
73
 
74
  elif filter_type == "Rainbow":