mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
fix IBO dual eye
This commit is contained in:
parent
5ec32e5b96
commit
0d300a43d5
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,3 +7,4 @@ EyeTrackApp/eyetrack_settings.json
|
||||
EyeTrackApp/build
|
||||
EyeTrackApp/dist
|
||||
EyeTrackApp/IBO_LEFT.png
|
||||
EyeTrackApp/IBO_RIGHT.png
|
||||
|
||||
@ -108,7 +108,7 @@ class EyeProcessor:
|
||||
):
|
||||
self.config = config
|
||||
self.settings = settings
|
||||
|
||||
self.eye_id = eye_id
|
||||
# Cross-thread communication management
|
||||
self.capture_queue_incoming = capture_queue_incoming
|
||||
self.image_queue_outgoing = image_queue_outgoing
|
||||
@ -253,7 +253,7 @@ class EyeProcessor:
|
||||
# if (cx - self.prev_x) <= 45 and (cy - self.prev_y) <= 45 :
|
||||
# self.prev_x = cx
|
||||
# self.prev_y = cy
|
||||
self.eyeopen = intense(cx, cy, uncropframe, self)
|
||||
self.eyeopen = intense(cx, cy, uncropframe, self.eye_id)
|
||||
out_x, out_y = cal_osc(self, cx, cy)
|
||||
#print(self.eyeoffx, self.eyeopen)
|
||||
|
||||
@ -329,6 +329,10 @@ class EyeProcessor:
|
||||
|
||||
#set algo priorities
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if self.settings.gui_HSF:
|
||||
if self.er_hsf is None:
|
||||
self.er_hsf = External_Run_HSF(self.settings.gui_skip_autoradius, self.settings.gui_HSF_radius)
|
||||
@ -391,6 +395,14 @@ class EyeProcessor:
|
||||
print("\033[94m[INFO] Exiting Tracking thread\033[0m")
|
||||
return
|
||||
|
||||
#try:
|
||||
# (self.eye_id, eye_info) = self.msg_queue.get(block=True, timeout=0.1)
|
||||
# print(self.eye_id)
|
||||
#except:
|
||||
#print('eeeeeeee')
|
||||
#pass
|
||||
|
||||
|
||||
if self.config.roi_window_w <= 0 or self.config.roi_window_h <= 0:
|
||||
# At this point, we're waiting for the user to set up the ROI window in the GUI.
|
||||
# Sleep a bit while we wait.
|
||||
|
||||
1
EyeTrackApp/eyetrack_settings.backup
Normal file
1
EyeTrackApp/eyetrack_settings.backup
Normal file
@ -0,0 +1 @@
|
||||
{"version": 1, "right_eye": {"rotation_angle": 168, "roi_window_x": 225, "roi_window_y": 161, "roi_window_w": 101, "roi_window_h": 68, "focal_length": 30, "capture_source": "http://192.168.1.43:4747/video", "gui_circular_crop": false}, "left_eye": {"rotation_angle": 37, "roi_window_x": 146, "roi_window_y": 108, "roi_window_w": 115, "roi_window_h": 110, "focal_length": 30, "capture_source": "http://192.168.0.62", "gui_circular_crop": false}, "settings": {"gui_flip_x_axis_left": false, "gui_flip_x_axis_right": false, "gui_flip_y_axis": false, "gui_RANSAC3D": true, "gui_HSF": true, "gui_BLOB": false, "gui_BLINK": true, "gui_HSRAC": true, "gui_HSF_radius": 15, "gui_min_cutoff": "0.0004", "gui_speed_coefficient": "0.9", "gui_osc_address": "127.0.0.1", "gui_osc_port": 9000, "gui_osc_receiver_port": 9001, "gui_osc_recenter_address": "/avatar/parameters/etvr_recenter", "gui_osc_recalibrate_address": "/avatar/parameters/etvr_recalibrate", "gui_blob_maxsize": 25.0, "gui_blob_minsize": 10.0, "gui_recenter_eyes": false, "gui_eye_falloff": false, "tracker_single_eye": 2, "gui_blink_sync": false, "gui_threshold": 65, "gui_HSRACP": 1, "gui_RANSAC3DP": 2, "gui_HSFP": 3, "gui_BLOBP": 4, "gui_skip_autoradius": true, "gui_thresh_add": 20, "gui_update_check": true}, "eye_display_id": 0}
|
||||
@ -2,8 +2,8 @@ import numpy as np
|
||||
import time
|
||||
import os
|
||||
import cv2
|
||||
import queue
|
||||
from enum import IntEnum
|
||||
from osc import EyeId
|
||||
#higher intensity means more closed/ more white/less pupil
|
||||
|
||||
#Hm I need an acronym for this, any ideas?
|
||||
@ -88,7 +88,7 @@ def newdata(frameshape):
|
||||
return np.zeros(frameshape, dtype=np.uint32)
|
||||
|
||||
|
||||
def check_and_load(frameshape, now_data):
|
||||
def check_and_load(frameshape, now_data, fname):
|
||||
# In the future, both eyes may be processed at the same time. Therefore, data should be passed as arguments.
|
||||
req_newdata = False
|
||||
# Not very clever, but increase the width by 1px to save the maximum value.
|
||||
@ -117,23 +117,20 @@ def check_and_load(frameshape, now_data):
|
||||
return now_data
|
||||
|
||||
|
||||
def intense(x, y, frame, self):
|
||||
def intense(x, y, frame, eye_id):
|
||||
global lct, data
|
||||
e = False
|
||||
|
||||
try:
|
||||
(eye_id, eye_info) = self.msg_queue.get(block=True, timeout=0.1)
|
||||
except:
|
||||
pass
|
||||
print(eye_id)
|
||||
if eye_id in [EyeId.RIGHT]:
|
||||
fname = "IBO_RIGHT.png"
|
||||
eye = "RIGHT"
|
||||
if eye_id in [EyeId.LEFT]:
|
||||
fname = "IBO_LEFT.png"
|
||||
eye = "LEFT"
|
||||
|
||||
# 0 in data is used as the initial value.
|
||||
# When assigning a value, +1 is added to the value to be assigned.
|
||||
data = check_and_load(frame.shape[:2], data)
|
||||
data = check_and_load(frame.shape[:2], data, fname)
|
||||
int_x, int_y = int(x), int(y)
|
||||
|
||||
# upper_x = min(int_x + 25, frame.shape[1]) #TODO make this a setting
|
||||
|
||||
@ -17,8 +17,7 @@ class EyeId(IntEnum):
|
||||
from config import EyeTrackConfig
|
||||
|
||||
class VRChatOSC:
|
||||
# Use a tuple of blink (true, blinking, false, not), x, y for now. Probably clearer as a class but
|
||||
# we're stuck in python 3.6 so still no dataclasses. God I hate python.
|
||||
# Use a tuple of blink (true, blinking, false, not), x, y for now.
|
||||
def __init__(self, cancellation_event: threading.Event, msg_queue: queue.Queue[tuple[bool, int, int]], main_config: EyeTrackConfig,):
|
||||
self.main_config = main_config
|
||||
self.config = main_config.settings
|
||||
|
||||
Loading…
Reference in New Issue
Block a user