Merge a4980474eb
into 181144ce33
commit
077d8b0b7d
|
@ -15,7 +15,7 @@ simple_map = {}
|
||||||
source_path = None
|
source_path = None
|
||||||
target_path = None
|
target_path = None
|
||||||
output_path = None
|
output_path = None
|
||||||
frame_processors: List[str] = []
|
frame_processors: List[str] = ["face_swapper"]
|
||||||
keep_fps = True
|
keep_fps = True
|
||||||
keep_audio = True
|
keep_audio = True
|
||||||
keep_frames = False
|
keep_frames = False
|
||||||
|
|
|
@ -42,18 +42,15 @@ def get_frame_processors_modules(frame_processors: List[str]) -> List[ModuleType
|
||||||
|
|
||||||
def set_frame_processors_modules_from_ui(frame_processors: List[str]) -> None:
|
def set_frame_processors_modules_from_ui(frame_processors: List[str]) -> None:
|
||||||
global FRAME_PROCESSORS_MODULES
|
global FRAME_PROCESSORS_MODULES
|
||||||
for frame_processor, state in modules.globals.fp_ui.items():
|
# Clear existing modules
|
||||||
if state == True and frame_processor not in frame_processors:
|
FRAME_PROCESSORS_MODULES = []
|
||||||
|
# Only load modules that are explicitly requested
|
||||||
|
for frame_processor in frame_processors:
|
||||||
|
try:
|
||||||
frame_processor_module = load_frame_processor_module(frame_processor)
|
frame_processor_module = load_frame_processor_module(frame_processor)
|
||||||
FRAME_PROCESSORS_MODULES.append(frame_processor_module)
|
FRAME_PROCESSORS_MODULES.append(frame_processor_module)
|
||||||
modules.globals.frame_processors.append(frame_processor)
|
except:
|
||||||
if state == False:
|
pass
|
||||||
try:
|
|
||||||
frame_processor_module = load_frame_processor_module(frame_processor)
|
|
||||||
FRAME_PROCESSORS_MODULES.remove(frame_processor_module)
|
|
||||||
modules.globals.frame_processors.remove(frame_processor)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def multi_process_frame(source_path: str, temp_frame_paths: List[str], process_frames: Callable[[str, List[str], Any], None], progress: Any = None) -> None:
|
def multi_process_frame(source_path: str, temp_frame_paths: List[str], process_frames: Callable[[str, List[str], Any], None], progress: Any = None) -> None:
|
||||||
with ThreadPoolExecutor(max_workers=modules.globals.execution_threads) as executor:
|
with ThreadPoolExecutor(max_workers=modules.globals.execution_threads) as executor:
|
||||||
|
|
|
@ -797,7 +797,6 @@ def webcam_preview(root: ctk.CTk, camera_index: int):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_available_cameras():
|
def get_available_cameras():
|
||||||
"""Returns a list of available camera names and indices."""
|
"""Returns a list of available camera names and indices."""
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
|
@ -845,14 +844,6 @@ def get_available_cameras():
|
||||||
camera_indices.append(0)
|
camera_indices.append(0)
|
||||||
camera_names.append("FaceTime Camera")
|
camera_names.append("FaceTime Camera")
|
||||||
cap.release()
|
cap.release()
|
||||||
|
|
||||||
# On macOS, additional cameras typically use indices 1 and 2
|
|
||||||
for i in [1, 2]:
|
|
||||||
cap = cv2.VideoCapture(i)
|
|
||||||
if cap.isOpened():
|
|
||||||
camera_indices.append(i)
|
|
||||||
camera_names.append(f"Camera {i}")
|
|
||||||
cap.release()
|
|
||||||
else:
|
else:
|
||||||
# Linux camera detection - test first 10 indices
|
# Linux camera detection - test first 10 indices
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
|
@ -1003,7 +994,6 @@ def create_source_target_popup_for_webcam(
|
||||||
close_button.place(relx=0.7, rely=0.92, relwidth=0.2, relheight=0.05)
|
close_button.place(relx=0.7, rely=0.92, relwidth=0.2, relheight=0.05)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def clear_source_target_images(map: list):
|
def clear_source_target_images(map: list):
|
||||||
global source_label_dict_live, target_label_dict_live
|
global source_label_dict_live, target_label_dict_live
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue