From 0f190e6efae93924587440236b3592b9ff77ea05 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Wed, 21 Sep 2022 15:57:47 +0200 Subject: Defining a draw method for GazePosition. --- src/argaze/GazeFeatures.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') 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.""" -- cgit v1.1