mirror of
https://github.com/hacksider/Deep-Live-Cam.git
synced 2025-03-27 02:02:08 +01:00
Revert "Update ui.py"
This reverts commit df72a5431b36afccf25e53c4a057cbe8caf77673.
This commit is contained in:
parent
df72a5431b
commit
97a76c5e5b
@ -1404,14 +1404,15 @@ def create_webcam_preview(camera_index: int):
|
||||
|
||||
# FPS tracking variables
|
||||
prev_time = time.time()
|
||||
fps_update_interval = 1.0
|
||||
fps_update_interval = 1.0 # Increased to 1 second for stability
|
||||
frame_count = 0
|
||||
fps = 0
|
||||
fps_display = "FPS: --"
|
||||
fps_display = "FPS: --" # Initialize fps display text
|
||||
|
||||
# Remove cached show_fps value - we'll check it in real-time instead
|
||||
# Cache frequently accessed values
|
||||
live_mirror = modules.globals.live_mirror
|
||||
live_resizable = modules.globals.live_resizable
|
||||
show_fps = modules.globals.show_fps
|
||||
map_faces = modules.globals.map_faces
|
||||
|
||||
while camera.isOpened() and PREVIEW.state() != "withdrawn":
|
||||
@ -1437,20 +1438,20 @@ def create_webcam_preview(camera_index: int):
|
||||
for frame_processor in frame_processors:
|
||||
temp_frame = frame_processor.process_frame_v2(temp_frame)
|
||||
|
||||
# FPS calculation (always calculate it)
|
||||
# FPS calculation and display
|
||||
frame_count += 1
|
||||
current_time = time.time()
|
||||
if current_time - prev_time >= fps_update_interval:
|
||||
fps = frame_count / (current_time - prev_time)
|
||||
fps_display = f"FPS: {fps:.1f}"
|
||||
fps_display = f"FPS: {fps:.1f}" # Update display text
|
||||
frame_count = 0
|
||||
prev_time = current_time
|
||||
|
||||
# Check show_fps state in real-time
|
||||
if modules.globals.show_fps:
|
||||
# Always show the last calculated FPS value
|
||||
if show_fps:
|
||||
cv2.putText(
|
||||
temp_frame,
|
||||
fps_display,
|
||||
fps_display, # Use stored fps display text
|
||||
(10, 30),
|
||||
cv2.FONT_HERSHEY_SIMPLEX,
|
||||
1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user