Compare commits
	
		
			4 Commits 
		
	
	
		
			1b59c3ba24
			...
			1127b59cab
		
	
	| Author | SHA1 | Date | 
|---|---|---|
|  | 1127b59cab | |
|  | 8b3d046550 | |
|  | 5dd6d1fe64 | |
|  | 9af216e819 | 
|  | @ -41,3 +41,5 @@ show_mouth_mask_box = False | |||
| mask_feather_ratio = 8 | ||||
| mask_down_size = 0.50 | ||||
| mask_size = 1 | ||||
| opacity = 1.0 | ||||
| face_swapper_enabled = True | ||||
|  |  | |||
|  | @ -14,6 +14,7 @@ from modules.utilities import ( | |||
|     is_video, | ||||
| ) | ||||
| from modules.cluster_analysis import find_closest_centroid | ||||
| from modules.globals import face_swapper_enabled, opacity | ||||
| import os | ||||
| 
 | ||||
| FACE_SWAPPER = None | ||||
|  | @ -100,6 +101,9 @@ def swap_face(source_face: Face, target_face: Face, temp_frame: Frame) -> Frame: | |||
| 
 | ||||
| 
 | ||||
| def process_frame(source_face: Face, temp_frame: Frame) -> Frame: | ||||
|     if getattr(modules.globals, "opacity", 1.0) == 0: | ||||
|         return temp_frame | ||||
| 
 | ||||
|     if modules.globals.color_correction: | ||||
|         temp_frame = cv2.cvtColor(temp_frame, cv2.COLOR_BGR2RGB) | ||||
| 
 | ||||
|  | @ -116,6 +120,9 @@ def process_frame(source_face: Face, temp_frame: Frame) -> Frame: | |||
| 
 | ||||
| 
 | ||||
| def process_frame_v2(temp_frame: Frame, temp_frame_path: str = "") -> Frame: | ||||
|     if getattr(modules.globals, "opacity", 1.0) == 0: | ||||
|         return temp_frame | ||||
| 
 | ||||
|     if is_image(modules.globals.target_path): | ||||
|         if modules.globals.many_faces: | ||||
|             source_face = default_source_face() | ||||
|  |  | |||
|  | @ -27,6 +27,7 @@ from modules.utilities import ( | |||
| ) | ||||
| from modules.video_capture import VideoCapturer | ||||
| from modules.gettext import LanguageManager | ||||
| from modules import globals | ||||
| import platform | ||||
| 
 | ||||
| if platform.system() == "Windows": | ||||
|  | @ -175,13 +176,21 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C | |||
|     ) | ||||
|     select_target_button.place(relx=0.6, rely=0.375, relwidth=0.3, relheight=0.1) | ||||
| 
 | ||||
|     transparency_values = ["25%", "50%", "75%", "100%"] | ||||
|     transparency_values = ["0%","25%", "50%", "75%", "100%"] | ||||
|     transparency_var = ctk.StringVar(value="100%")  # Default to 100% | ||||
| 
 | ||||
|     def on_transparency_change(value: str): | ||||
|         percentage = int(value.strip('%')) | ||||
|         opacity = percentage / 100.0 | ||||
|         modules.globals.opacity = opacity  # Save opacity globally for real-time updates | ||||
|         modules.globals.opacity = percentage / 100.0 | ||||
| 
 | ||||
|         if percentage == 0: | ||||
|             modules.globals.fp_ui["face_enhancer"] = False | ||||
|             update_status("Transparency set to 0% - Face swapping disabled.") | ||||
|         elif percentage == 100: | ||||
|             modules.globals.face_swapper_enabled = True | ||||
|             update_status("Transparency set to 100%.") | ||||
|         else: | ||||
|             modules.globals.face_swapper_enabled = True | ||||
|             update_status(f"Transparency set to {value}") | ||||
| 
 | ||||
|     transparency_label = ctk.CTkLabel(root, text="Transparency:") | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue