hamz011 commited on
Commit
aa03475
1 Parent(s): 0101638

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -64,9 +64,12 @@ def apply_vignette_filter(frame):
64
  kernel_y = cv2.getGaussianKernel(rows, rows / 2)
65
  kernel = kernel_y * kernel_x.T
66
  mask = 255 * kernel / np.max(kernel)
67
- vignette = np.zeros_like(frame)
68
  for i in range(3): # Her renk kanalı için vignette uygulama
69
  vignette[:, :, i] = frame[:, :, i] * mask
 
 
 
70
  return vignette
71
  def apply_pencil_sketch(frame):
72
  gray, sketch = cv2.pencilSketch(frame, sigma_s=60, sigma_r=0.07, shade_factor=0.05)
 
64
  kernel_y = cv2.getGaussianKernel(rows, rows / 2)
65
  kernel = kernel_y * kernel_x.T
66
  mask = 255 * kernel / np.max(kernel)
67
+ vignette = np.zeros_like(frame, dtype=np.float32) # Daha hassas türde işlem yapma
68
  for i in range(3): # Her renk kanalı için vignette uygulama
69
  vignette[:, :, i] = frame[:, :, i] * mask
70
+
71
+ # Değerleri uint8 formatına dönüştürme
72
+ vignette = np.clip(vignette, 0, 255).astype(np.uint8)
73
  return vignette
74
  def apply_pencil_sketch(frame):
75
  gray, sketch = cv2.pencilSketch(frame, sigma_s=60, sigma_r=0.07, shade_factor=0.05)