From 10ccd0328c2892534a3ed659d4921f2de90c3fb1 Mon Sep 17 00:00:00 2001 From: Kotrix Date: Sun, 4 Dec 2016 20:28:56 +0100 Subject: [PATCH] Removed redundant calculations Operations inside for loops are unnecessary. They are repeated anyway just below for loops --- modules/video/src/lkpyramid.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/modules/video/src/lkpyramid.cpp b/modules/video/src/lkpyramid.cpp index 8cf1579..b32c298 100644 --- a/modules/video/src/lkpyramid.cpp +++ b/modules/video/src/lkpyramid.cpp @@ -1265,8 +1265,6 @@ getRTMatrix( const Point2f* a, const Point2f* b, sa[1][1] += a[i].y*a[i].y; sa[1][2] += a[i].y; - sa[2][2] += 1; - sb[0] += a[i].x*b[i].x; sb[1] += a[i].y*b[i].x; sb[2] += b[i].x; @@ -1281,7 +1279,7 @@ getRTMatrix( const Point2f* a, const Point2f* b, sa[3][3] = sa[0][0]; sa[4][4] = sa[1][1]; - sa[5][5] = sa[2][2]; + sa[5][5] = sa[2][2] = count; solve( A, B, MM, DECOMP_EIG ); } @@ -1297,14 +1295,6 @@ getRTMatrix( const Point2f* a, const Point2f* b, sa[0][2] += a[i].x; sa[0][3] += a[i].y; - - sa[2][1] += -a[i].y; - sa[2][2] += 1; - - sa[3][0] += a[i].y; - sa[3][1] += a[i].x; - sa[3][3] += 1; - sb[0] += a[i].x*b[i].x + a[i].y*b[i].y; sb[1] += a[i].x*b[i].y - a[i].y*b[i].x; sb[2] += b[i].x; -- 2.7.4