Blurサイズ問題の修正

This commit is contained in:
2026-02-19 09:45:05 +09:00
parent 9ce6ec99d3
commit da9de60697
8 changed files with 61 additions and 51 deletions
+10
View File
@@ -20,6 +20,7 @@ KEY_BAKED = "facemask_baked_filepath"
KEY_MODE = "facemask_source_mode"
KEY_FORMAT = "facemask_bake_format"
KEY_BLUR_SIZE = "facemask_bake_blur_size"
KEY_DISPLAY_SCALE = "facemask_bake_display_scale"
FORMAT_EXT = {
@@ -86,20 +87,27 @@ class SEQUENCER_OT_bake_and_swap_blur_source(Operator):
bake_format = scene.facemask_bake_format
output_path = _output_path(video_strip, detections_path, bake_format)
blur_size = int(scene.facemask_bake_blur_size)
display_scale = float(scene.facemask_bake_display_scale)
# Reuse baked cache when parameters match and file still exists.
cached_baked_path = video_strip.get(KEY_BAKED)
cached_format = video_strip.get(KEY_FORMAT)
cached_blur_size = video_strip.get(KEY_BLUR_SIZE)
cached_display_scale = video_strip.get(KEY_DISPLAY_SCALE)
try:
cached_blur_size_int = int(cached_blur_size)
except (TypeError, ValueError):
cached_blur_size_int = None
try:
cached_display_scale_f = float(cached_display_scale)
except (TypeError, ValueError):
cached_display_scale_f = None
if (
cached_baked_path
and os.path.exists(cached_baked_path)
and cached_format == bake_format
and cached_blur_size_int == blur_size
and cached_display_scale_f == display_scale
):
if video_strip.get(KEY_MODE) != "baked":
video_strip[KEY_MODE] = "baked"
@@ -126,6 +134,7 @@ class SEQUENCER_OT_bake_and_swap_blur_source(Operator):
strip[KEY_MODE] = "baked"
strip[KEY_FORMAT] = bake_format
strip[KEY_BLUR_SIZE] = blur_size
strip[KEY_DISPLAY_SCALE] = display_scale
_set_strip_source(strip, result_path)
print(f"[FaceMask] Bake completed and source swapped: {result_path}")
elif status == "error":
@@ -153,6 +162,7 @@ class SEQUENCER_OT_bake_and_swap_blur_source(Operator):
detections_path=detections_path,
output_path=output_path,
blur_size=blur_size,
display_scale=display_scale,
fmt=bake_format.lower(),
on_complete=on_complete,
on_progress=on_progress,
-2
View File
@@ -110,7 +110,6 @@ class SEQUENCER_OT_generate_face_mask(Operator):
# Get parameters from scene properties
conf_threshold = scene.facemask_conf_threshold
iou_threshold = scene.facemask_iou_threshold
mask_scale = scene.facemask_mask_scale
# Start generation
generator.start(
@@ -121,7 +120,6 @@ class SEQUENCER_OT_generate_face_mask(Operator):
fps=fps,
conf_threshold=conf_threshold,
iou_threshold=iou_threshold,
mask_scale=mask_scale,
on_complete=on_complete,
on_progress=on_progress,
)