Yaroslav
commited on
making real 60: part 1
Browse files
app.py
CHANGED
|
@@ -40,10 +40,10 @@ def increase_fps(input_video_path, target_fps=60):
|
|
| 40 |
# Оптический поток
|
| 41 |
flow = cv2.calcOpticalFlowFarneback(prev_frame_gray, next_frame_gray, None, 0.5, 3, 15, 3, 5, 1.2, 0)
|
| 42 |
|
| 43 |
-
# Генерация промежуточных кадров
|
| 44 |
for i in range(1, int(ratio)):
|
| 45 |
alpha = i / ratio
|
| 46 |
-
|
|
|
|
| 47 |
output.write(intermediate_frame)
|
| 48 |
|
| 49 |
output.write(next_frame)
|
|
|
|
| 40 |
# Оптический поток
|
| 41 |
flow = cv2.calcOpticalFlowFarneback(prev_frame_gray, next_frame_gray, None, 0.5, 3, 15, 3, 5, 1.2, 0)
|
| 42 |
|
|
|
|
| 43 |
for i in range(1, int(ratio)):
|
| 44 |
alpha = i / ratio
|
| 45 |
+
flow_intermediate = flow * alpha
|
| 46 |
+
intermediate_frame = cv2.remap(prev_frame, flow_intermediate, None, cv2.INTER_LINEAR)
|
| 47 |
output.write(intermediate_frame)
|
| 48 |
|
| 49 |
output.write(next_frame)
|