aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2022-09-21 15:57:47 +0200
committerThéo de la Hogue2022-09-21 15:57:47 +0200
commit0f190e6efae93924587440236b3592b9ff77ea05 (patch)
tree0ea748f4030f8f6418b5c9b39c64a1faf349a20d
parent57b43e855725f6be8d9cad36bf858807915ebd12 (diff)
downloadargaze-0f190e6efae93924587440236b3592b9ff77ea05.zip
argaze-0f190e6efae93924587440236b3592b9ff77ea05.tar.gz
argaze-0f190e6efae93924587440236b3592b9ff77ea05.tar.bz2
argaze-0f190e6efae93924587440236b3592b9ff77ea05.tar.xz
Defining a draw method for GazePosition.
-rw-r--r--src/argaze/GazeFeatures.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py
index 717e01b..1c5f537 100644
--- a/src/argaze/GazeFeatures.py
+++ b/src/argaze/GazeFeatures.py
@@ -8,6 +8,7 @@ from argaze.AreaOfInterest import AOIFeatures
import numpy
import pandas
+import cv2 as cv
@dataclass
class GazePosition():
@@ -33,6 +34,15 @@ class GazePosition():
def __array__(self):
return numpy.array(self.value)
+ def draw(self, frame, color=(0, 255, 255)):
+
+ # Draw point at position
+ cv.circle(frame, self.value, 2, color, -1)
+
+ # Draw accuracy circle
+ if self.accuracy > 0:
+ cv.circle(frame, self.value, round(self.accuracy), color, 1)
+
class GazePositionMissing(GazePosition, Exception):
"""Exception to raise when gaze position is missing."""