Reorganized switches
parent
01ef955372
commit
a101a1f3f1
|
@ -302,21 +302,21 @@ def create_curved_eyebrow(points):
|
||||||
x = np.linspace(x_min, x_max, num_points)
|
x = np.linspace(x_min, x_max, num_points)
|
||||||
|
|
||||||
# Fit quadratic curve through points for more natural arch
|
# Fit quadratic curve through points for more natural arch
|
||||||
coeffs = np.polyfit(sorted_points[:, 0], sorted_points[:, 1], 2) # Changed to quadratic
|
coeffs = np.polyfit(sorted_points[:, 0], sorted_points[:, 1], 2)
|
||||||
y = np.polyval(coeffs, x)
|
y = np.polyval(coeffs, x)
|
||||||
|
|
||||||
# Create points for top and bottom curves with consistent offsets
|
# Increased offsets to create more separation
|
||||||
top_offset = height * 0.3 # Simplified offset for cleaner curve
|
top_offset = height * 0.5 # Increased from 0.3 to shift up more
|
||||||
bottom_offset = height * 0.1 # Thinner bottom curve
|
bottom_offset = height * 0.2 # Increased from 0.1 to shift down more
|
||||||
|
|
||||||
# Create smooth curves
|
# Create smooth curves
|
||||||
top_curve = y - top_offset
|
top_curve = y - top_offset
|
||||||
bottom_curve = y + bottom_offset
|
bottom_curve = y + bottom_offset
|
||||||
|
|
||||||
# Create curved endpoints with slight taper
|
# Create curved endpoints with more pronounced taper
|
||||||
end_points = 5
|
end_points = 5
|
||||||
start_x = np.linspace(x[0] - width * 0.1, x[0], end_points)
|
start_x = np.linspace(x[0] - width * 0.15, x[0], end_points) # Increased taper
|
||||||
end_x = np.linspace(x[-1], x[-1] + width * 0.1, end_points)
|
end_x = np.linspace(x[-1], x[-1] + width * 0.15, end_points) # Increased taper
|
||||||
|
|
||||||
# Create tapered ends
|
# Create tapered ends
|
||||||
start_curve = np.column_stack((
|
start_curve = np.column_stack((
|
||||||
|
@ -339,7 +339,7 @@ def create_curved_eyebrow(points):
|
||||||
# Add slight padding for better coverage
|
# Add slight padding for better coverage
|
||||||
center = np.mean(contour_points, axis=0)
|
center = np.mean(contour_points, axis=0)
|
||||||
vectors = contour_points - center
|
vectors = contour_points - center
|
||||||
padded_points = center + vectors * 1.15 # 15% padding
|
padded_points = center + vectors * 1.2 # Increased padding slightly
|
||||||
|
|
||||||
return padded_points
|
return padded_points
|
||||||
return points
|
return points
|
||||||
|
@ -395,21 +395,21 @@ def create_eyebrows_mask(face: Face, frame: Frame) -> (np.ndarray, np.ndarray, t
|
||||||
x = np.linspace(x_min, x_max, num_points)
|
x = np.linspace(x_min, x_max, num_points)
|
||||||
|
|
||||||
# Fit quadratic curve through points for more natural arch
|
# Fit quadratic curve through points for more natural arch
|
||||||
coeffs = np.polyfit(sorted_points[:, 0], sorted_points[:, 1], 2) # Changed to quadratic
|
coeffs = np.polyfit(sorted_points[:, 0], sorted_points[:, 1], 2)
|
||||||
y = np.polyval(coeffs, x)
|
y = np.polyval(coeffs, x)
|
||||||
|
|
||||||
# Create points for top and bottom curves with consistent offsets
|
# Increased offsets to create more separation
|
||||||
top_offset = height * 0.3 # Simplified offset for cleaner curve
|
top_offset = height * 0.5 # Increased from 0.3 to shift up more
|
||||||
bottom_offset = height * 0.1 # Thinner bottom curve
|
bottom_offset = height * 0.2 # Increased from 0.1 to shift down more
|
||||||
|
|
||||||
# Create smooth curves
|
# Create smooth curves
|
||||||
top_curve = y - top_offset
|
top_curve = y - top_offset
|
||||||
bottom_curve = y + bottom_offset
|
bottom_curve = y + bottom_offset
|
||||||
|
|
||||||
# Create curved endpoints with slight taper
|
# Create curved endpoints with more pronounced taper
|
||||||
end_points = 5
|
end_points = 5
|
||||||
start_x = np.linspace(x[0] - width * 0.1, x[0], end_points)
|
start_x = np.linspace(x[0] - width * 0.15, x[0], end_points) # Increased taper
|
||||||
end_x = np.linspace(x[-1], x[-1] + width * 0.1, end_points)
|
end_x = np.linspace(x[-1], x[-1] + width * 0.15, end_points) # Increased taper
|
||||||
|
|
||||||
# Create tapered ends
|
# Create tapered ends
|
||||||
start_curve = np.column_stack((
|
start_curve = np.column_stack((
|
||||||
|
@ -432,7 +432,7 @@ def create_eyebrows_mask(face: Face, frame: Frame) -> (np.ndarray, np.ndarray, t
|
||||||
# Add slight padding for better coverage
|
# Add slight padding for better coverage
|
||||||
center = np.mean(contour_points, axis=0)
|
center = np.mean(contour_points, axis=0)
|
||||||
vectors = contour_points - center
|
vectors = contour_points - center
|
||||||
padded_points = center + vectors * 1.15 # 15% padding
|
padded_points = center + vectors * 1.2 # Increased padding slightly
|
||||||
|
|
||||||
return padded_points
|
return padded_points
|
||||||
return points
|
return points
|
||||||
|
|
|
@ -279,7 +279,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
||||||
)
|
)
|
||||||
show_fps_switch.place(relx=0.1, rely=0.75)
|
show_fps_switch.place(relx=0.1, rely=0.75)
|
||||||
|
|
||||||
# Additional Options (Middle Right)
|
# Mask Switches (Middle Right - Top Section)
|
||||||
mouth_mask_var = ctk.BooleanVar(value=modules.globals.mouth_mask)
|
mouth_mask_var = ctk.BooleanVar(value=modules.globals.mouth_mask)
|
||||||
mouth_mask_switch = ctk.CTkSwitch(
|
mouth_mask_switch = ctk.CTkSwitch(
|
||||||
root,
|
root,
|
||||||
|
@ -290,19 +290,6 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
||||||
)
|
)
|
||||||
mouth_mask_switch.place(relx=0.6, rely=0.50)
|
mouth_mask_switch.place(relx=0.6, rely=0.50)
|
||||||
|
|
||||||
show_mouth_mask_box_var = ctk.BooleanVar(value=modules.globals.show_mouth_mask_box)
|
|
||||||
show_mouth_mask_box_switch = ctk.CTkSwitch(
|
|
||||||
root,
|
|
||||||
text=_("Show Mouth Mask Box"),
|
|
||||||
variable=show_mouth_mask_box_var,
|
|
||||||
cursor="hand2",
|
|
||||||
command=lambda: setattr(
|
|
||||||
modules.globals, "show_mouth_mask_box", show_mouth_mask_box_var.get()
|
|
||||||
),
|
|
||||||
)
|
|
||||||
show_mouth_mask_box_switch.place(relx=0.6, rely=0.55)
|
|
||||||
|
|
||||||
# Add eyes mask switch
|
|
||||||
eyes_mask_var = ctk.BooleanVar(value=modules.globals.eyes_mask)
|
eyes_mask_var = ctk.BooleanVar(value=modules.globals.eyes_mask)
|
||||||
eyes_mask_switch = ctk.CTkSwitch(
|
eyes_mask_switch = ctk.CTkSwitch(
|
||||||
root,
|
root,
|
||||||
|
@ -311,22 +298,8 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
||||||
cursor="hand2",
|
cursor="hand2",
|
||||||
command=lambda: setattr(modules.globals, "eyes_mask", eyes_mask_var.get()),
|
command=lambda: setattr(modules.globals, "eyes_mask", eyes_mask_var.get()),
|
||||||
)
|
)
|
||||||
eyes_mask_switch.place(relx=0.6, rely=0.60)
|
eyes_mask_switch.place(relx=0.6, rely=0.55)
|
||||||
|
|
||||||
# Add show eyes mask box switch
|
|
||||||
show_eyes_mask_box_var = ctk.BooleanVar(value=modules.globals.show_eyes_mask_box)
|
|
||||||
show_eyes_mask_box_switch = ctk.CTkSwitch(
|
|
||||||
root,
|
|
||||||
text=_("Show Eyes Mask Box"),
|
|
||||||
variable=show_eyes_mask_box_var,
|
|
||||||
cursor="hand2",
|
|
||||||
command=lambda: setattr(
|
|
||||||
modules.globals, "show_eyes_mask_box", show_eyes_mask_box_var.get()
|
|
||||||
),
|
|
||||||
)
|
|
||||||
show_eyes_mask_box_switch.place(relx=0.6, rely=0.65)
|
|
||||||
|
|
||||||
# Move the eyebrows mask switches up slightly
|
|
||||||
eyebrows_mask_var = ctk.BooleanVar(value=modules.globals.eyebrows_mask)
|
eyebrows_mask_var = ctk.BooleanVar(value=modules.globals.eyebrows_mask)
|
||||||
eyebrows_mask_switch = ctk.CTkSwitch(
|
eyebrows_mask_switch = ctk.CTkSwitch(
|
||||||
root,
|
root,
|
||||||
|
@ -335,12 +308,37 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
||||||
cursor="hand2",
|
cursor="hand2",
|
||||||
command=lambda: setattr(modules.globals, "eyebrows_mask", eyebrows_mask_var.get()),
|
command=lambda: setattr(modules.globals, "eyebrows_mask", eyebrows_mask_var.get()),
|
||||||
)
|
)
|
||||||
eyebrows_mask_switch.place(relx=0.6, rely=0.70)
|
eyebrows_mask_switch.place(relx=0.6, rely=0.60)
|
||||||
|
|
||||||
|
# Box Visualization Switches (Middle Right - Bottom Section)
|
||||||
|
show_mouth_mask_box_var = ctk.BooleanVar(value=modules.globals.show_mouth_mask_box)
|
||||||
|
show_mouth_mask_box_switch = ctk.CTkSwitch(
|
||||||
|
root,
|
||||||
|
text=_("Show Mouth Box"),
|
||||||
|
variable=show_mouth_mask_box_var,
|
||||||
|
cursor="hand2",
|
||||||
|
command=lambda: setattr(
|
||||||
|
modules.globals, "show_mouth_mask_box", show_mouth_mask_box_var.get()
|
||||||
|
),
|
||||||
|
)
|
||||||
|
show_mouth_mask_box_switch.place(relx=0.6, rely=0.65)
|
||||||
|
|
||||||
|
show_eyes_mask_box_var = ctk.BooleanVar(value=modules.globals.show_eyes_mask_box)
|
||||||
|
show_eyes_mask_box_switch = ctk.CTkSwitch(
|
||||||
|
root,
|
||||||
|
text=_("Show Eyes Box"),
|
||||||
|
variable=show_eyes_mask_box_var,
|
||||||
|
cursor="hand2",
|
||||||
|
command=lambda: setattr(
|
||||||
|
modules.globals, "show_eyes_mask_box", show_eyes_mask_box_var.get()
|
||||||
|
),
|
||||||
|
)
|
||||||
|
show_eyes_mask_box_switch.place(relx=0.6, rely=0.70)
|
||||||
|
|
||||||
show_eyebrows_mask_box_var = ctk.BooleanVar(value=modules.globals.show_eyebrows_mask_box)
|
show_eyebrows_mask_box_var = ctk.BooleanVar(value=modules.globals.show_eyebrows_mask_box)
|
||||||
show_eyebrows_mask_box_switch = ctk.CTkSwitch(
|
show_eyebrows_mask_box_switch = ctk.CTkSwitch(
|
||||||
root,
|
root,
|
||||||
text=_("Show Eyebrows Mask Box"),
|
text=_("Show Eyebrows Box"),
|
||||||
variable=show_eyebrows_mask_box_var,
|
variable=show_eyebrows_mask_box_var,
|
||||||
cursor="hand2",
|
cursor="hand2",
|
||||||
command=lambda: setattr(
|
command=lambda: setattr(
|
||||||
|
|
Loading…
Reference in New Issue