diff --git a/src/deepstream/probes/frame_comparison/gpu/frame_change_detector.cpp b/src/deepstream/probes/frame_comparison/gpu/frame_change_detector.cpp index 7d679b6..9e252b7 100644 --- a/src/deepstream/probes/frame_comparison/gpu/frame_change_detector.cpp +++ b/src/deepstream/probes/frame_comparison/gpu/frame_change_detector.cpp @@ -5,9 +5,13 @@ #include #include +const double MSE_THRESH = 20.0; +const double SSIM_THRESH = 0.998; +const double FLOW_THRESH = 0.5; +const double OPTICAL_FLOW_ACTIVE_THRESH = 0.5; GPUFrameChangeDetector::GPUFrameChangeDetector() - : mse_thresh(500.0), ssim_thresh(0.99), flow_thresh(2.0), initialized(true) {} + : mse_thresh(MSE_THRESH), ssim_thresh(SSIM_THRESH), flow_thresh(FLOW_THRESH), initialized(true) {} static cv::Scalar mean_gpu(const cv::cuda::GpuMat& mat) { cv::Scalar sum_val = cv::cuda::sum(mat); @@ -80,7 +84,7 @@ double GPUFrameChangeDetector::optical_flow_gpu(const cv::cuda::GpuMat& imgA, co cv::cuda::cartToPolar(flow_xy[0], flow_xy[1], mag, angle, true); cv::cuda::GpuMat active_mask; - cv::cuda::threshold(mag, active_mask, 0.5, 1.0, cv::THRESH_BINARY); + cv::cuda::threshold(mag, active_mask, OPTICAL_FLOW_ACTIVE_THRESH, 1.0, cv::THRESH_BINARY); cv::cuda::GpuMat active_pixels; mag.copyTo(active_pixels, active_mask); @@ -108,7 +112,7 @@ GPUFrameChangeDetector::should_process_gpu_direct(const cv::cuda::GpuMat& gpu_fr double ssim_val = simple_ssim_gpu(prev_frame_gpu, processed_curr); double flow_val = optical_flow_gpu(prev_frame_gpu, processed_curr); - bool is_static = (mse_val < 10.0 && ssim_val > 0.995 && flow_val < 0.05); + bool is_static = (mse_val < mse_thresh && ssim_val > ssim_thresh && flow_val < flow_thresh); bool should_proc = !is_static; if (should_proc) { diff --git a/src/deepstream/probes/frame_comparison/gpu/frame_skipping_probe.cpython-310-aarch64-linux-gnu.so b/src/deepstream/probes/frame_comparison/gpu/frame_skipping_probe.cpython-310-aarch64-linux-gnu.so index 136cf15..da15fdb 100755 Binary files a/src/deepstream/probes/frame_comparison/gpu/frame_skipping_probe.cpython-310-aarch64-linux-gnu.so and b/src/deepstream/probes/frame_comparison/gpu/frame_skipping_probe.cpython-310-aarch64-linux-gnu.so differ