Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -104,14 +104,14 @@ def aplicar_glitch(video_clip):
|
|
104 |
"""Aplica un efecto de glitch al video."""
|
105 |
def glitch_effect(frame):
|
106 |
import numpy as np
|
107 |
-
# Desplazar aleatoriamente filas de píxeles
|
108 |
height, width, _ = frame.shape
|
109 |
offset = np.random.randint(-10, 10)
|
110 |
if offset > 0:
|
111 |
offset = min(offset, height)
|
112 |
if offset < 0:
|
113 |
offset = max(offset, -height + 1)
|
114 |
-
|
|
|
115 |
return frame
|
116 |
|
117 |
return video_clip.fl_image(glitch_effect)
|
|
|
104 |
"""Aplica un efecto de glitch al video."""
|
105 |
def glitch_effect(frame):
|
106 |
import numpy as np
|
|
|
107 |
height, width, _ = frame.shape
|
108 |
offset = np.random.randint(-10, 10)
|
109 |
if offset > 0:
|
110 |
offset = min(offset, height)
|
111 |
if offset < 0:
|
112 |
offset = max(offset, -height + 1)
|
113 |
+
if offset!= 0 and height > 0:
|
114 |
+
frame[offset:, :] = np.roll(frame[:-offset, :], -offset, axis=0)
|
115 |
return frame
|
116 |
|
117 |
return video_clip.fl_image(glitch_effect)
|