diff options
Diffstat (limited to 'src/argaze/AreaOfInterest/AOIFeatures.py')
-rw-r--r-- | src/argaze/AreaOfInterest/AOIFeatures.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/argaze/AreaOfInterest/AOIFeatures.py b/src/argaze/AreaOfInterest/AOIFeatures.py index a33db26..dc38eb8 100644 --- a/src/argaze/AreaOfInterest/AOIFeatures.py +++ b/src/argaze/AreaOfInterest/AOIFeatures.py @@ -2,7 +2,7 @@ from dataclasses import dataclass, field -from argaze import DataStructures +from argaze import DataStructures, GazeFeatures import cv2 as cv import matplotlib.path as mpath @@ -38,7 +38,7 @@ class AreaOfInterest(numpy.ndarray): if self.dimension() != 2: raise RuntimeError(f'Bad area dimension ({self.dimension()})') - return mpath.Path(self).contains_points([(gaze_position.x, gaze_position.y)])[0] + return mpath.Path(self).contains_points([gaze_position])[0] def look_at(self, gaze_position): """Get where the area is looked.""" @@ -46,7 +46,7 @@ class AreaOfInterest(numpy.ndarray): if self.dimension() != 2: raise RuntimeError(f'Bad area dimension ({self.dimension()})') - P = numpy.array([gaze_position.x, gaze_position.y]) + P = numpy.array(gaze_position) clockwise_area = self.clockwise() @@ -54,7 +54,7 @@ class AreaOfInterest(numpy.ndarray): OX, OY = clockwise_area[1] - O, clockwise_area[-1] - O OP = P - O - return numpy.array([numpy.dot(OP, OX) / numpy.dot(OX, OX), numpy.dot(OP, OY) / numpy.dot(OY, OY)]) + return ( round(numpy.dot(OP, OX) / numpy.dot(OX, OX), 3), round(numpy.dot(OP, OY) / numpy.dot(OY, OY), 3)) def draw(self, frame, color): |