diff --git a/__init__.py b/__init__.py index 252bd76..748e2fc 100644 --- a/__init__.py +++ b/__init__.py @@ -480,7 +480,7 @@ class VideoCutFromDir: "required": { "frame_dir": ("STRING", {"default": None}), "threshold": ("FLOAT", { - "default": 0.5, + "default": 0.7, "min": 0.01, "max": 1.0, "step": 0.01, diff --git a/videoCut.py b/videoCut.py index 13769e5..3051a6b 100644 --- a/videoCut.py +++ b/videoCut.py @@ -57,19 +57,21 @@ def getCutList(imagePath, threshold, min_frame, max_frame): i += 1 i = min_frame - 1 - threshold = (sum(resList) / len(resList)) * threshold + avg = sum(resList) / len(resList) + threshold = avg * threshold while i < len(pngList) - 1: if num >= max_frame: num = 0 cutList.append(pngList[i]) i += min_frame - elif similarity < threshold: + elif resList[i] < threshold: num = 0 cutList.append(pngList[i]) i += min_frame else: i += 1 - print(resList) + print("平均计算阈值:"+str(avg)+" 处理阈值:"+str(threshold)) + print(cutList) return cutList