From 2f2a147ab7435887feff6dfcfc5053474941edc4 Mon Sep 17 00:00:00 2001 From: Roy Shilkrot Date: Thu, 14 Mar 2024 15:51:35 -0400 Subject: [PATCH] Fix image similarity calculation in background filter (#558) * Fix image similarity calculation in background filter * Update version number in buildspec.json --- buildspec.json | 2 +- src/background-filter.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/buildspec.json b/buildspec.json index 8aa70abe..fceb9383 100644 --- a/buildspec.json +++ b/buildspec.json @@ -39,7 +39,7 @@ } }, "name": "obs-backgroundremoval", - "version": "1.1.11", + "version": "1.1.12", "author": "Roy Shilkrot", "website": "https://github.com/royshil/obs-backgroundremoval", "email": "roy.shil@gmail.com", diff --git a/src/background-filter.cpp b/src/background-filter.cpp index 9a667220..9ce62a0b 100644 --- a/src/background-filter.cpp +++ b/src/background-filter.cpp @@ -585,7 +585,8 @@ void background_removal_thread(void *data) } if (tf->enableImageSimilarity) { - if (!lastImageBGRA.empty()) { + if (!lastImageBGRA.empty() && !imageBGRA.empty() && + lastImageBGRA.size() == imageBGRA.size()) { // calculate PSNR double psnr = cv::PSNR(lastImageBGRA, imageBGRA);