mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
force push with python upgrade
This commit is contained in:
parent
43e86c2ae8
commit
45df46ac07
@ -1,5 +1,3 @@
|
|||||||
import time
|
|
||||||
|
|
||||||
import PySimpleGUI as sg
|
import PySimpleGUI as sg
|
||||||
from config import EyeTrackConfig
|
from config import EyeTrackConfig
|
||||||
from config import EyeTrackSettingsConfig
|
from config import EyeTrackSettingsConfig
|
||||||
@ -11,12 +9,9 @@ from queue import Queue, Empty
|
|||||||
from camera import Camera, CameraState
|
from camera import Camera, CameraState
|
||||||
from osc import EyeId
|
from osc import EyeId
|
||||||
import cv2
|
import cv2
|
||||||
import sys
|
|
||||||
from utils.misc_utils import PlaySound, SND_FILENAME, SND_ASYNC, resource_path
|
from utils.misc_utils import PlaySound, SND_FILENAME, SND_ASYNC, resource_path
|
||||||
import traceback
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
class CameraWidget:
|
class CameraWidget:
|
||||||
def __init__(self, widget_id: EyeId, main_config: EyeTrackConfig, osc_queue: Queue):
|
def __init__(self, widget_id: EyeId, main_config: EyeTrackConfig, osc_queue: Queue):
|
||||||
self.gui_camera_addr = f"-CAMERAADDR{widget_id}-"
|
self.gui_camera_addr = f"-CAMERAADDR{widget_id}-"
|
||||||
@ -47,7 +42,6 @@ class CameraWidget:
|
|||||||
self.configl = main_config.left_eye
|
self.configl = main_config.left_eye
|
||||||
self.configr = main_config.right_eye
|
self.configr = main_config.right_eye
|
||||||
self.settings = main_config.settings
|
self.settings = main_config.settings
|
||||||
self.update_wait_count = 100
|
|
||||||
if self.eye_id == EyeId.RIGHT:
|
if self.eye_id == EyeId.RIGHT:
|
||||||
self.config = main_config.right_eye
|
self.config = main_config.right_eye
|
||||||
elif self.eye_id == EyeId.LEFT:
|
elif self.eye_id == EyeId.LEFT:
|
||||||
@ -312,7 +306,6 @@ class CameraWidget:
|
|||||||
|
|
||||||
if event == self.gui_tracking_button:
|
if event == self.gui_tracking_button:
|
||||||
print("\033[94m[INFO] Moving to tracking mode\033[0m")
|
print("\033[94m[INFO] Moving to tracking mode\033[0m")
|
||||||
self.update_wait_count = 100
|
|
||||||
self.in_roi_mode = False
|
self.in_roi_mode = False
|
||||||
self.camera.set_output_queue(self.capture_queue)
|
self.camera.set_output_queue(self.capture_queue)
|
||||||
window[self.gui_roi_layout].update(visible=False)
|
window[self.gui_roi_layout].update(visible=False)
|
||||||
@ -320,7 +313,6 @@ class CameraWidget:
|
|||||||
|
|
||||||
if event == self.gui_roi_button:
|
if event == self.gui_roi_button:
|
||||||
print("\033[94m[INFO] Move to roi mode\033[0m")
|
print("\033[94m[INFO] Move to roi mode\033[0m")
|
||||||
self.update_wait_count = 100
|
|
||||||
self.in_roi_mode = True
|
self.in_roi_mode = True
|
||||||
self.camera.set_output_queue(self.roi_queue)
|
self.camera.set_output_queue(self.roi_queue)
|
||||||
window[self.gui_roi_layout].update(visible=True)
|
window[self.gui_roi_layout].update(visible=True)
|
||||||
@ -428,8 +420,6 @@ class CameraWidget:
|
|||||||
window[self.gui_output_graph].update(visible=False)
|
window[self.gui_output_graph].update(visible=False)
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
if self.update_wait_count >= 0:
|
|
||||||
self.update_wait_count = self.update_wait_count - 1
|
|
||||||
window[self.gui_roi_message].update(visible=False)
|
window[self.gui_roi_message].update(visible=False)
|
||||||
window[self.gui_output_graph].update(visible=True)
|
window[self.gui_output_graph].update(visible=True)
|
||||||
(maybe_image, eye_info) = self.image_queue.get(block=False)
|
(maybe_image, eye_info) = self.image_queue.get(block=False)
|
||||||
|
|||||||
@ -50,18 +50,9 @@ def run_model(input_queue, output_queue, session):
|
|||||||
if frame is None:
|
if frame is None:
|
||||||
break
|
break
|
||||||
|
|
||||||
# to_tensor = transforms.ToTensor()
|
|
||||||
# img_tensor = to_tensor(frame)
|
|
||||||
# img_tensor.unsqueeze_(0)
|
|
||||||
# img_np = img_tensor.numpy()
|
|
||||||
img_np = np.array(frame)
|
img_np = np.array(frame)
|
||||||
# Normalize the pixel values to [0, 1] and convert the data type to float32
|
|
||||||
img_np = img_np.astype(np.float32) / 255.0
|
img_np = img_np.astype(np.float32) / 255.0
|
||||||
|
|
||||||
# Transpose the dimensions from (height, width, channels) to (channels, height, width)
|
|
||||||
img_np = np.transpose(img_np, (2, 0, 1))
|
img_np = np.transpose(img_np, (2, 0, 1))
|
||||||
|
|
||||||
# Add a batch dimension
|
|
||||||
img_np = np.expand_dims(img_np, axis=0)
|
img_np = np.expand_dims(img_np, axis=0)
|
||||||
ort_inputs = {session.get_inputs()[0].name: img_np}
|
ort_inputs = {session.get_inputs()[0].name: img_np}
|
||||||
pre_landmark = session.run(None, ort_inputs)
|
pre_landmark = session.run(None, ort_inputs)
|
||||||
|
|||||||
1260
poetry.lock
generated
1260
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,7 @@ license = "MIT"
|
|||||||
repository = "https://github.com/EyeTrackVR/EyeTrackVR"
|
repository = "https://github.com/EyeTrackVR/EyeTrackVR"
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "~3.10.0"
|
python = "~3.11.0"
|
||||||
python-osc = "^1.8.0"
|
python-osc = "^1.8.0"
|
||||||
requests = "^2.28.1"
|
requests = "^2.28.1"
|
||||||
opencv-python = "^4.6.0.66"
|
opencv-python = "^4.6.0.66"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user