aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/argaze.test/GazeFeatures.py12
-rw-r--r--src/argaze/ArFeatures.py18
-rw-r--r--src/argaze/GazeAnalysis/LinearRegression.py6
3 files changed, 20 insertions, 16 deletions
diff --git a/src/argaze.test/GazeFeatures.py b/src/argaze.test/GazeFeatures.py
index c0c014c..035c76a 100644
--- a/src/argaze.test/GazeFeatures.py
+++ b/src/argaze.test/GazeFeatures.py
@@ -71,7 +71,7 @@ class TestGazePositionClass(unittest.TestCase):
empty_gaze_position = GazeFeatures.GazePosition(message="empty for test")
self.assertEqual(empty_gaze_position, ())
- self.assertEqual(empty_gaze_position.value, ())
+ self.assertEqual(empty_gaze_position, ())
self.assertEqual(empty_gaze_position.precision, None)
self.assertEqual(empty_gaze_position.message, "empty for test")
self.assertEqual(len(empty_gaze_position), 0)
@@ -84,7 +84,7 @@ class TestGazePositionClass(unittest.TestCase):
self.assertEqual(int_gaze_position, (123, 456))
self.assertEqual(int_gaze_position[0], 123)
self.assertEqual(int_gaze_position[1], 456)
- self.assertEqual(int_gaze_position.value, (123, 456))
+ self.assertEqual(int_gaze_position, (123, 456))
self.assertEqual(int_gaze_position.precision, 55)
self.assertEqual(len(int_gaze_position), 2)
self.assertEqual(bool(int_gaze_position), True)
@@ -96,7 +96,7 @@ class TestGazePositionClass(unittest.TestCase):
self.assertEqual(float_gaze_position, (1.23, 4.56))
self.assertEqual(float_gaze_position[0], 1.23)
self.assertEqual(float_gaze_position[1], 4.56)
- self.assertEqual(float_gaze_position.value, (1.23, 4.56))
+ self.assertEqual(float_gaze_position, (1.23, 4.56))
self.assertEqual(float_gaze_position.precision, 5.5)
self.assertEqual(len(float_gaze_position), 2)
self.assertEqual(bool(float_gaze_position), True)
@@ -111,9 +111,11 @@ class TestGazePositionClass(unittest.TestCase):
with self.assertRaises(AttributeError):
gaze_position.value = (12, 34)
+ # WARNING: gaze_position = (12, 34) is possible !!!!
+ # How to prevent this?
- self.assertNotEqual(gaze_position.value, (12, 34))
- self.assertEqual(gaze_position.value, ())
+ self.assertNotEqual(gaze_position, (12, 34))
+ self.assertEqual(gaze_position, ())
# Check that gaze position precision setting fails
with self.assertRaises(AttributeError):
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py
index 95d89d9..abe4ed7 100644
--- a/src/argaze/ArFeatures.py
+++ b/src/argaze/ArFeatures.py
@@ -958,7 +958,7 @@ class ArFrame(DataFeatures.SharedObject, DataFeatures.PipelineStepObject):
scale = numpy.array([self.__heatmap.size[0] / self.__size[0], self.__heatmap.size[1] / self.__size[1]])
# Update heatmap image
- self.__heatmap.update(timestamp, self.__calibrated_gaze_position.value * scale)
+ self.__heatmap.update(timestamp, self.__calibrated_gaze_position * scale)
# Look layers with valid identified gaze movement
# Note: don't filter valid/unvalid finished/unfished gaze movement to allow layers to reset internally
@@ -1470,16 +1470,18 @@ class ArCamera(ArFrame):
aoi_2d = camera_layer.aoi_scene[scene_frame.name]
- # TODO?: Should we prefer to use camera frame AOIMatcher object?
- if aoi_2d.contains_point(gaze_position.value):
+ if gaze_position:
- inner_x, inner_y = aoi_2d.clockwise().inner_axis(*gaze_position.value)
+ # TODO?: Should we prefer to use camera frame AOIMatcher object?
+ if aoi_2d.contains_point(gaze_position):
- # QUESTION: How to project gaze precision?
- inner_gaze_position = GazeFeatures.GazePosition((inner_x, inner_y))
+ inner_x, inner_y = aoi_2d.clockwise().inner_axis(*gaze_position)
- # Project inner gaze position into scene frame
- scene_frame.look(timestamp, inner_gaze_position * scene_frame.size)
+ # QUESTION: How to project gaze precision?
+ inner_gaze_position = GazeFeatures.GazePosition((inner_x, inner_y))
+
+ # Project inner gaze position into scene frame
+ scene_frame.look(timestamp, inner_gaze_position * scene_frame.size)
# Ignore missing aoi in camera frame layer projection
except KeyError as e:
diff --git a/src/argaze/GazeAnalysis/LinearRegression.py b/src/argaze/GazeAnalysis/LinearRegression.py
index 414832a..717e8a3 100644
--- a/src/argaze/GazeAnalysis/LinearRegression.py
+++ b/src/argaze/GazeAnalysis/LinearRegression.py
@@ -45,8 +45,8 @@ class GazePositionCalibrator(GazeFeatures.GazePositionCalibrator):
def store(self, timestamp: int|float, observed_gaze_position: GazeFeatures.GazePosition, expected_gaze_position: GazeFeatures.GazePosition):
"""Store observed and expected gaze positions."""
- self.__observed_positions.append(observed_gaze_position.value)
- self.__expected_positions.append(expected_gaze_position.value)
+ self.__observed_positions.append(observed_gaze_position)
+ self.__expected_positions.append(expected_gaze_position)
def reset(self):
"""Reset observed and expected gaze positions."""
@@ -78,7 +78,7 @@ class GazePositionCalibrator(GazeFeatures.GazePositionCalibrator):
if not self.calibrating:
- return GazeFeatures.GazePosition(self.__linear_regression.predict(numpy.array([gaze_position.value]))[0], precision=gaze_position.precision)
+ return GazeFeatures.GazePosition(self.__linear_regression.predict(numpy.array([gaze_position]))[0], precision=gaze_position.precision)
else: