Skip to content

Commit 9cc0e55

Browse files
committed
Updated main.py
src/model.py src/mouse_controller.py Signed-off-by: Mpho Mphego <mpho112@gmail.com>
1 parent b274c25 commit 9cc0e55

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ def main(args):
198198
head_pose_estimation.show_text(frame, head_pose_angles)
199199
gaze_estimation.show_text(frame, gaze_vector)
200200

201-
print(f"gaze_vector: x: {gaze_vector['x']:.2f}, y: {gaze_vector['y']:.2f}")
202201
if args.enable_mouse:
203202
mouse_controller.move(gaze_vector["x"], gaze_vector["y"])
204203

src/model.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,18 +257,22 @@ def preprocess_output(self, inference_results, image, show_bbox=False):
257257
eye_size = 10
258258

259259
left_eye_x_coord = int(eyes_coords[0] * w)
260+
# left eye offset of face
260261
left_eye_xmin = left_eye_x_coord - eye_size
261262
left_eye_xmax = left_eye_x_coord + eye_size
262263

263264
left_eye_y_coord = int(eyes_coords[1] * h)
265+
# left eye offset of face
264266
left_eye_ymin = left_eye_y_coord - eye_size
265267
left_eye_ymax = left_eye_y_coord + eye_size
266268

267269
right_eye_x_coord = int(eyes_coords[2] * w)
270+
# right eye offset of face
268271
right_eye_xmin = right_eye_x_coord - eye_size
269272
right_eye_xmax = right_eye_x_coord + eye_size
270273

271274
right_eye_y_coord = int(eyes_coords[3] * h)
275+
# right eye offset of face
272276
right_eye_ymin = right_eye_y_coord - eye_size
273277
right_eye_ymax = right_eye_y_coord + eye_size
274278

src/mouse_controller.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ def move(self, x, y):
2525
try:
2626
start_pos = pyautogui.position()
2727
pyautogui.moveRel(
28-
-x * self.precision, y * self.precision, duration=self.speed
28+
-x * self.precision/2., y * self.precision/2., duration=self.speed
2929
)
3030
end_pos = pyautogui.position()
31-
logger.info(f"Mouse -> start_pos: {start_pos}, end_pos: {end_pos}")
31+
logger.debug(f"Mouse -> start_pos: {start_pos}, end_pos: {end_pos}")
3232
except pyautogui.FailSafeException:
3333
logger.exception(f"Position: {x}, {y} are out of the screen")
3434
pyautogui.moveRel(
35-
x * self.precision, -1 * y * self.precision, duration=self.speed
35+
-x * self.precision, y * self.precision, duration=self.speed
3636
)
3737
def left_click(self):
3838
pass

0 commit comments

Comments
 (0)