From 452eae3da5dc06519503a2d58115e229c70f19cb Mon Sep 17 00:00:00 2001
From: "lodenthal@uni-bielefeld.de" <lodenthal@uni-bielefeld.de>
Date: Mon, 28 May 2018 18:20:53 +0300
Subject: [PATCH] repaired optic flow test

---
 navipy/maths/coordinates.py         |  3 +++
 navipy/processing/test_OpticFlow.py | 18 +++++++++---------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/navipy/maths/coordinates.py b/navipy/maths/coordinates.py
index d2bbdc2..d6809c3 100644
--- a/navipy/maths/coordinates.py
+++ b/navipy/maths/coordinates.py
@@ -4,6 +4,8 @@
 import numpy as np
 from navipy.maths.homogeneous_transformations import rotation_matrix
 from navipy.scene import is_numeric_array
+from navipy.maths.homogeneous_transformations\
+    import compose_matrix
 
 
 def cartesian_to_spherical(x, y, z):
@@ -64,6 +66,7 @@ def cartesian_to_spherical_vectors(opticFlow, angles, viewing_direction):
                          direction must be of size two")
 
     vec = opticFlow
+    ypr=angles
     M = compose_matrix(scale=None, shear=None, angles=ypr, translate=None,
                        perspective=None, axes='rzyx')[:3, :3]
     vec = np.dot(np.transpose(M), vec)
diff --git a/navipy/processing/test_OpticFlow.py b/navipy/processing/test_OpticFlow.py
index 8de0161..2e9db4a 100644
--- a/navipy/processing/test_OpticFlow.py
+++ b/navipy/processing/test_OpticFlow.py
@@ -702,15 +702,15 @@ class TestCase(unittest.TestCase):
                    [-0.09950368, -0.0994883, -0.09944262],
                    [-0.09950195, -0.09948661, -0.09944095]]
         """
-        testrof = [[4.99512718e-07, 4.99512718e-07, 4.99512718e-07],
-                   [3.25455335e-07, 3.27951595e-07, 3.30500411e-07],
-                   [1.50999906e-07, 1.54939566e-07, 1.58985369e-07]]
-        testhof = [[9.88397894e-06, 1.74640417e-03, 3.48239240e-03],
-                   [-1.66074328e-04, 1.57018176e-03, 3.30590701e-03],
-                   [-3.41982048e-04, 1.39348106e-03, 3.12841462e-03]]
-        testvof = [[-0.09950042, -0.09948509, -0.09943946],
-                   [-0.09950043, -0.09948513, -0.09943953],
-                   [-0.09950044, -0.09948517, -0.0994396]]
+        testrof = [[-8.88472903e-19, -8.87544964e-19, -8.84761429e-19],
+                   [1.30104261e-18, -2.16840434e-19, -8.67361738e-19],
+                   [-4.33680869e-19, 0.00000000e+00, 4.33680869e-19]]
+        testhof = [[3.18909128e-10, 1.73652203e-03, 3.47251478e-03],
+                   [-1.74233017e-04, 1.56202421e-03, 3.29775256e-03],
+                   [-3.48413280e-04, 1.38705059e-03, 3.12198582e-03]]
+        testvof = [[-0.09950042, -0.09948526, -0.0994398],
+                   [-0.09950042, -0.09948526, -0.0994398],
+                   [-0.09950042, -0.09948526, -0.0994398]]
 
         assert np.all(np.isclose(rof, testrof))
         assert np.all(np.isclose(hof, testhof))
-- 
GitLab