From de214950c4777ba7995ac06818cafe692ef225a4 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Wed, 21 Aug 2013 18:17:45 +0400 Subject: [PATCH] minor gpu TVL1 optical flow optimization: don't calc diff term if it is not used for epsilon criterion --- modules/gpu/src/tvl1flow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/gpu/src/tvl1flow.cpp b/modules/gpu/src/tvl1flow.cpp index b8322e2c46..9971324af1 100644 --- a/modules/gpu/src/tvl1flow.cpp +++ b/modules/gpu/src/tvl1flow.cpp @@ -222,7 +222,8 @@ void cv::gpu::OpticalFlowDual_TVL1_GPU::procOneScale(const GpuMat& I0, const Gpu { estimateU(I1wx, I1wy, grad, rho_c, p11, p12, p21, p22, u1, u2, diff, l_t, static_cast(theta)); - error = gpu::sum(diff, norm_buf)[0]; + if (epsilon > 0) + error = gpu::sum(diff, norm_buf)[0]; estimateDualVariables(u1, u2, p11, p12, p21, p22, taut); }