Skip to content

Commit a18e63f

Browse files
authored
Merge pull request #2072 from pupil-labs/develop
Pupil v3.0 Release Candidate 1
2 parents af660c3 + b92e24f commit a18e63f

File tree

27 files changed

+694
-972
lines changed

27 files changed

+694
-972
lines changed

deployment/deploy_capture/bundle.spec

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import sys
1010

1111
import numpy
1212
import pkg_resources
13-
from PyInstaller.utils.hooks import collect_submodules
13+
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
1414

1515
hidden_imports = []
1616
hidden_imports += collect_submodules("av")
@@ -40,6 +40,8 @@ if not glfw_path.exists():
4040
glfw_path = pathlib.Path(pkg_resources.resource_filename("glfw", glfw_name))
4141
glfw_binaries = [(glfw_path.name, str(glfw_path), "BINARY")]
4242

43+
data_files_pye3d = collect_data_files("pye3d")
44+
4345
if platform.system() == "Darwin":
4446
sys.path.append(".")
4547
from version import pupil_version
@@ -52,6 +54,7 @@ if platform.system() == "Darwin":
5254
hookspath=None,
5355
runtime_hooks=None,
5456
excludes=["matplotlib"],
57+
datas=data_files_pye3d,
5558
)
5659
pyz = PYZ(a.pure)
5760
exe = EXE(
@@ -104,6 +107,7 @@ elif platform.system() == "Linux":
104107
hookspath=None,
105108
runtime_hooks=None,
106109
excludes=["matplotlib"],
110+
datas=data_files_pye3d,
107111
)
108112

109113
pyz = PYZ(a.pure)
@@ -172,7 +176,7 @@ elif platform.system() == "Windows":
172176
["../../pupil_src/main.py"],
173177
pathex=["../../pupil_src/shared_modules/", str(external_libs_path)],
174178
binaries=None,
175-
datas=None,
179+
datas=data_files_pye3d,
176180
hiddenimports=hidden_imports,
177181
hookspath=None,
178182
runtime_hooks=None,

deployment/deploy_player/bundle.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import sys
1010

1111
import numpy
1212
import pkg_resources
13-
from PyInstaller.utils.hooks import collect_submodules
13+
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
1414

1515
hidden_imports = []
1616
hidden_imports += collect_submodules("av")
@@ -40,6 +40,8 @@ if not glfw_path.exists():
4040
glfw_path = pathlib.Path(pkg_resources.resource_filename("glfw", glfw_name))
4141
glfw_binaries = [(glfw_path.name, str(glfw_path), "BINARY")]
4242

43+
data_files_pye3d = collect_data_files("pye3d")
44+
4345
if platform.system() == "Darwin":
4446
sys.path.append(".")
4547
from version import pupil_version
@@ -53,6 +55,7 @@ if platform.system() == "Darwin":
5355
hookspath=None,
5456
runtime_hooks=None,
5557
excludes=["matplotlib"],
58+
datas=data_files_pye3d,
5659
)
5760

5861
pyz = PYZ(a.pure)
@@ -106,6 +109,7 @@ elif platform.system() == "Linux":
106109
hookspath=None,
107110
runtime_hooks=None,
108111
excludes=["matplotlib"],
112+
datas=data_files_pye3d,
109113
)
110114

111115
pyz = PYZ(a.pure)
@@ -177,6 +181,7 @@ elif platform.system() == "Windows":
177181
hookspath=None,
178182
runtime_hooks=None,
179183
excludes=["matplotlib"],
184+
datas=data_files_pye3d,
180185
)
181186

182187
pyz = PYZ(a.pure)

deployment/deploy_service/bundle.spec

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import sys
1010

1111
import numpy
1212
import pkg_resources
13-
from PyInstaller.utils.hooks import collect_submodules
13+
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
1414

1515
hidden_imports = []
1616
hidden_imports += collect_submodules("av")
@@ -30,6 +30,8 @@ if not glfw_path.exists():
3030
glfw_path = pathlib.Path(pkg_resources.resource_filename("glfw", glfw_name))
3131
glfw_binaries = [(glfw_path.name, str(glfw_path), "BINARY")]
3232

33+
data_files_pye3d = collect_data_files("pye3d")
34+
3335
if platform.system() == "Darwin":
3436
sys.path.append(".")
3537
from version import pupil_version
@@ -43,6 +45,7 @@ if platform.system() == "Darwin":
4345
hookspath=None,
4446
runtime_hooks=None,
4547
excludes=["matplotlib"],
48+
datas=data_files_pye3d,
4649
)
4750
pyz = PYZ(a.pure)
4851
exe = EXE(
@@ -89,6 +92,7 @@ elif platform.system() == "Linux":
8992
hookspath=None,
9093
runtime_hooks=None,
9194
excludes=["matplotlib"],
95+
datas=data_files_pye3d,
9296
)
9397

9498
pyz = PYZ(a.pure)
@@ -151,7 +155,7 @@ elif platform.system() == "Windows":
151155
["../../pupil_src/main.py"],
152156
pathex=["../../pupil_src/shared_modules/", str(external_libs_path)],
153157
binaries=None,
154-
datas=None,
158+
datas=data_files_pye3d,
155159
hiddenimports=hidden_imports,
156160
hookspath=None,
157161
runtime_hooks=None,

docs/dependencies-macos.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ brew install portaudio
4646
# tbb is included by default with https://github.com/Homebrew/homebrew-core/pull/20101
4747
brew install opencv
4848
brew install glew
49-
# dependencies for 2d_3d c++ detector
50-
brew install ceres-solver
5149
```
5250

5351
## libuvc

docs/dependencies-ubuntu17.md

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -119,35 +119,7 @@ sudo udevadm trigger
119119

120120
## 3D Eye Model Dependencies
121121
```sh
122-
sudo apt install -y libgoogle-glog-dev libatlas-base-dev libeigen3-dev
123-
```
124-
125-
## Ceres
126-
127-
You will need to build Ceres from source:
128-
```sh
129-
sudo add-apt-repository ppa:bzindovic/suitesparse-bugfix-1319687
130-
sudo apt-get update
131-
sudo apt-get install libsuitesparse-dev
132-
```
133-
134-
If `add-apt-repository` is not found, install the following package first:
135-
```sh
136-
sudo apt-get install software-properties-common
137-
```
138-
139-
The build and install the Ceres solver:
140-
```sh
141-
git clone https://ceres-solver.googlesource.com/ceres-solver
142-
cd ceres-solver
143-
git checkout 1.14.0
144-
mkdir build && cd build
145-
cmake .. -DBUILD_SHARED_LIBS=ON
146-
make -j3
147-
make test
148-
sudo make install
149-
sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/ceres.conf'
150-
sudo ldconfig
122+
sudo apt install -y libeigen3-dev
151123
```
152124

153125
### Install Python Libraries

docs/dependencies-ubuntu18.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ sudo apt install -y pkg-config git cmake build-essential nasm wget python3-setup
1212
# ffmpeg >= 3.2
1313
sudo apt install -y libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev libswscale-dev libavresample-dev ffmpeg x264 x265 libportaudio2 portaudio19-dev
1414

15-
# OpenCV >= 3
16-
sudo apt install -y python3-opencv libopencv-dev
17-
18-
# 3D Eye model dependencies
19-
sudo apt install -y libgoogle-glog-dev libatlas-base-dev libeigen3-dev
20-
sudo apt install -y libceres-dev
15+
# OpenCV >= 3 + Eigen
16+
sudo apt install -y python3-opencv libopencv-dev libeigen3-dev
2117
```
2218

2319
## Turbojpeg

pupil_src/launchables/eye.py

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def eye(
6565
hide_ui=False,
6666
debug=False,
6767
pub_socket_hwm=None,
68+
parent_application="capture",
6869
):
6970
"""reads eye video and detects the pupil.
7071
@@ -190,7 +191,7 @@ def interrupt_handler(sig, frame):
190191
g_pool.debug = debug
191192
g_pool.user_dir = user_dir
192193
g_pool.version = version
193-
g_pool.app = "capture"
194+
g_pool.app = parent_application
194195
g_pool.eye_id = eye_id
195196
g_pool.process = f"eye{eye_id}"
196197
g_pool.timebase = timebase
@@ -223,7 +224,7 @@ def load_runtime_pupil_detection_plugins():
223224
continue
224225
yield plugin
225226

226-
default_2d, default_3d, available_detectors = available_detector_plugins()
227+
available_detectors = available_detector_plugins()
227228
runtime_detectors = list(load_runtime_pupil_detection_plugins())
228229
plugins = (
229230
manager_classes
@@ -253,13 +254,10 @@ def load_runtime_pupil_detection_plugins():
253254
# TODO: extend with plugins
254255
(default_capture_name, default_capture_settings),
255256
("UVC_Manager", {}),
256-
# Detectors needs to be loaded first to set `g_pool.pupil_detector`
257-
(default_2d.__name__, {}),
258-
(default_3d.__name__, {}),
257+
*[(p.__name__, {}) for p in available_detectors],
259258
("NDSI_Manager", {}),
260259
("HMD_Streaming_Manager", {}),
261260
("File_Manager", {}),
262-
("PupilDetectorManager", {}),
263261
("Roi", {}),
264262
]
265263

@@ -814,10 +812,10 @@ def window_should_update():
814812
plugin.alive = False
815813
g_pool.plugins.clean()
816814

817-
glfw.destroy_window(main_window)
818-
g_pool.gui.terminate()
819-
glfw.terminate()
820-
logger.info("Process shutting down.")
815+
glfw.destroy_window(main_window)
816+
g_pool.gui.terminate()
817+
glfw.terminate()
818+
logger.info("Process shutting down.")
821819

822820

823821
def eye_profiled(
@@ -833,14 +831,31 @@ def eye_profiled(
833831
hide_ui=False,
834832
debug=False,
835833
pub_socket_hwm=None,
834+
parent_application="capture",
836835
):
837836
import cProfile
838837
import subprocess
839838
import os
840839
from .eye import eye
841840

842841
cProfile.runctx(
843-
"eye(timebase, is_alive_flag,ipc_pub_url,ipc_sub_url,ipc_push_url, user_dir, version, eye_id, overwrite_cap_settings, hide_ui, debug)",
842+
(
843+
"eye("
844+
"timebase, "
845+
"is_alive_flag, "
846+
"ipc_pub_url, "
847+
"ipc_sub_url, "
848+
"ipc_push_url, "
849+
"user_dir, "
850+
"version, "
851+
"eye_id, "
852+
"overwrite_cap_settings, "
853+
"hide_ui, "
854+
"debug, "
855+
"pub_socket_hwm, "
856+
"parent_application, "
857+
")"
858+
),
844859
{
845860
"timebase": timebase,
846861
"is_alive_flag": is_alive_flag,
@@ -854,6 +869,7 @@ def eye_profiled(
854869
"hide_ui": hide_ui,
855870
"debug": debug,
856871
"pub_socket_hwm": pub_socket_hwm,
872+
"parent_application": parent_application,
857873
},
858874
locals(),
859875
"eye{}.pstats".format(eye_id),

pupil_src/launchables/world.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def world(
3636
Reacts to notifications:
3737
``eye_process.started``
3838
``start_plugin``
39+
``should_stop``
3940
4041
Emits notifications:
4142
``eye_process.should_start``
@@ -516,6 +517,8 @@ def handle_notifications(noti):
516517
)
517518
elif subject == "world_process.adapt_window_size":
518519
set_window_size()
520+
elif subject == "world_process.should_stop":
521+
glfw.set_window_should_close(main_window, True)
519522

520523
width, height = session_settings.get(
521524
"window_size", (1280 + icon_bar_width, 720)

pupil_src/main.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ def log_loop(ipc_sub_url, log_level_debug):
310310
parsed_args.hide_ui,
311311
parsed_args.debug,
312312
n.get("pub_socket_hwm"),
313+
parsed_args.app, # parent_application
313314
),
314315
).start()
315316
elif "notify.player_process.should_start" in topic:
@@ -392,6 +393,14 @@ def log_loop(ipc_sub_url, log_level_debug):
392393
"doc": launcher.__doc__,
393394
}
394395
)
396+
elif "notify.launcher_process.should_stop" in topic:
397+
if parsed_args.app == "capture":
398+
cmd_push.notify({"subject": "world_process.should_stop"})
399+
elif parsed_args.app == "service":
400+
cmd_push.notify({"subject": "service_process.should_stop"})
401+
elif parsed_args.app == "player":
402+
cmd_push.notify({"subject": "player_process.should_stop"})
403+
395404
else:
396405
if not active_children():
397406
break

pupil_src/shared_modules/blink_detection.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,6 @@ def recent_events(self, events={}):
160160
blink_type = "offset"
161161

162162
confidence = min(abs(filter_response), 1.0) # clamp conf. value at 1.
163-
logger.debug(
164-
"Blink {} detected with confidence {:0.3f}".format(blink_type, confidence)
165-
)
166163
# Add info to events
167164
blink_entry = {
168165
"topic": "blinks",

0 commit comments

Comments
 (0)