Spaces:
Running
Running
Update app.py
Browse files
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)
|