From 84d8f39ec92f1d924607fad5396613cfc5928489 Mon Sep 17 00:00:00 2001 From: zyddnys Date: Sat, 4 Jul 2020 17:09:17 -0400 Subject: [PATCH] fix SSIM --- main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 3a62a33..783536c 100644 --- a/main.py +++ b/main.py @@ -371,7 +371,10 @@ def detect_changes(last_frame, cur_frame, last_frame_bboxes, cur_frame_bboxes, s last_frame_box_img = clahe.apply(cv2.cvtColor(last_frame_box_img, cv2.COLOR_RGB2GRAY)) cur_frame_box_img = clahe.apply(cv2.cvtColor(cur_frame_box_img, cv2.COLOR_RGB2GRAY)) # compute SSIM - v = metrics.structural_similarity(last_frame_box_img, cur_frame_box_img) + try : + v = metrics.structural_similarity(last_frame_box_img, cur_frame_box_img) + except : + continue if v < ssim_threshold : # cv2.imshow('img1', last_frame_box_img) # cv2.imshow('img2', cur_frame_box_img)