Compare commits

..

1 Commits

Author SHA1 Message Date
rehanbgmi 9312f3292d
Merge 31515353e9 into ec6d7d2995 2025-06-01 19:55:16 -07:00
2 changed files with 20 additions and 1 deletions

View File

@ -41,4 +41,4 @@ show_mouth_mask_box = False
mask_feather_ratio = 8
mask_down_size = 0.50
mask_size = 1
enable_hair_swapping = False # Default state for enabling/disabling hair swapping
enable_hair_swapping = True # Default state for enabling/disabling hair swapping

View File

@ -124,6 +124,25 @@ def _prepare_warped_source_material_and_mask(
return warped_full_source_material, warped_combined_mask_binary_for_clone
def _blend_material_onto_frame(
logging.warning("Resizing hair mask to match face mask for source during preparation.")
hair_only_mask_source_binary = cv2.resize(
hair_only_mask_source_binary,
(face_only_mask_source_binary.shape[1], face_only_mask_source_binary.shape[0]),
interpolation=cv2.INTER_NEAREST
)
actual_combined_source_mask = cv2.bitwise_or(face_only_mask_source_binary, hair_only_mask_source_binary)
actual_combined_source_mask_blurred = cv2.GaussianBlur(actual_combined_source_mask, (5, 5), 3)
# Warp the Combined Mask and Full Source Material
warped_full_source_material = cv2.warpAffine(source_frame_full, matrix, dsize)
warped_combined_mask_temp = cv2.warpAffine(actual_combined_source_mask_blurred, matrix, dsize)
_, warped_combined_mask_binary_for_clone = cv2.threshold(warped_combined_mask_temp, 127, 255, cv2.THRESH_BINARY)
return warped_full_source_material, warped_combined_mask_binary_for_clone
# Ensure one blank line and correct indentation for the next function definition
def _blend_material_onto_frame(
base_frame: Frame,