Skip to content

Commit

Permalink
Merge pull request #1792 from pupil-labs/video-capture-skimming
Browse files Browse the repository at this point in the history
Video capture slimming
  • Loading branch information
Patrick Faion authored Feb 18, 2020
2 parents bccfa21 + e1a8305 commit b6c3a09
Show file tree
Hide file tree
Showing 18 changed files with 506 additions and 2,929 deletions.
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@ All setup and dependency installation instructions are contained in this repo. A
- [macOS](./docs/dependencies-macos.md "Pupil dependency installation for macOS")
- [Windows 10](./docs/dependencies-windows.md "Pupil dependency installation for Windows 10")

#### Intel RealSense 3D Support

If you want to use an Intel RealSense 3D scene camera, please follow the additional setup instructions for the camera model you have.

* **Intel RealSense R200**: Please follow our detailed [Setup Guide](./docs/dependencies-realsense-r200.md "RealSense R200 setup guide")
* **Intel RealSense D400**: You need to install the [Python wrapper for librealsense](https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python#python-wrapper "Install instructions for librealsense Python wrapper")


### Clone the repo
After you have installed all dependencies, clone this repo and start Pupil software.

Expand Down
8 changes: 1 addition & 7 deletions deployment/deploy_capture/bundle.spec
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ if platform.system() == "Darwin":
sys.path.append(".")
from version import pupil_version

import pyrealsense

pyrealsense_path = pathlib.Path(pyrealsense.__file__).parent / "lrs_parsed_classes"

del sys.path[-1]
a = Analysis(
["../../pupil_src/main.py"],
Expand Down Expand Up @@ -98,11 +94,9 @@ if platform.system() == "Darwin":
a.datas,
[("libuvc.0.dylib", "/usr/local/lib/libuvc.0.dylib", "BINARY")],
[("libglfw.dylib", "/usr/local/lib/libglfw.dylib", "BINARY")],
[("librealsense.dylib", "/usr/local/lib/librealsense.dylib", "BINARY")],
[("pyglui/OpenSans-Regular.ttf", ui.get_opensans_font_path(), "DATA")],
[("pyglui/Roboto-Regular.ttf", ui.get_roboto_font_path(), "DATA")],
[("pyglui/pupil_icons.ttf", ui.get_pupil_icons_font_path(), "DATA")],
[("pyrealsense/lrs_parsed_classes", pyrealsense_path, "DATA")],
apriltag_libs,
strip=None,
upx=True,
Expand All @@ -127,7 +121,7 @@ elif platform.system() == "Linux":
+ apriltag_hidden_imports,
hookspath=None,
runtime_hooks=None,
excludes=["matplotlib", "pyrealsense"],
excludes=["matplotlib"],
)

pyz = PYZ(a.pure)
Expand Down
6 changes: 3 additions & 3 deletions deployment/deploy_player/bundle.spec
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ if platform.system() == "Darwin":
),
hookspath=None,
runtime_hooks=None,
excludes=["matplotlib", "pyrealsense"],
excludes=["matplotlib"],
)

pyz = PYZ(a.pure)
Expand Down Expand Up @@ -126,7 +126,7 @@ elif platform.system() == "Linux":
+ apriltag_hidden_imports,
hookspath=None,
runtime_hooks=None,
excludes=["matplotlib", "pyrealsense"],
excludes=["matplotlib"],
)

pyz = PYZ(a.pure)
Expand Down Expand Up @@ -214,7 +214,7 @@ elif platform.system() == "Windows":
+ apriltag_hidden_imports,
hookspath=None,
runtime_hooks=None,
excludes=["matplotlib", "pyrealsense"],
excludes=["matplotlib"],
)

pyz = PYZ(a.pure)
Expand Down
6 changes: 3 additions & 3 deletions deployment/deploy_service/bundle.spec
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if platform.system() == "Darwin":
hiddenimports=[] + av_hidden_imports + pyglui_hidden_imports,
hookspath=None,
runtime_hooks=None,
excludes=["matplotlib", "pyrealsense"],
excludes=["matplotlib"],
)
pyz = PYZ(a.pure)
exe = EXE(
Expand Down Expand Up @@ -99,7 +99,7 @@ elif platform.system() == "Linux":
hiddenimports=[] + av_hidden_imports + pyglui_hidden_imports,
hookspath=None,
runtime_hooks=None,
excludes=["matplotlib", "pyrealsense"],
excludes=["matplotlib"],
)

pyz = PYZ(a.pure)
Expand Down Expand Up @@ -181,7 +181,7 @@ elif platform.system() == "Windows":
runtime_hooks=None,
win_no_prefer_redirects=False,
win_private_assemblies=False,
excludes=["matplotlib", "pyrealsense"],
excludes=["matplotlib"],
)

pyz = PYZ(a.pure)
Expand Down
41 changes: 0 additions & 41 deletions docs/dependencies-realsense-r200.md

This file was deleted.

27 changes: 18 additions & 9 deletions pupil_src/launchables/eye.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,19 +213,21 @@ def get_timestamp():
]
if eye_id == 0:
preferred_names += ["HD-6000"]
default_capture_settings = (
"UVC_Source",
{
"preferred_names": preferred_names,
"frame_size": (320, 240),
"frame_rate": 120,
},
)

default_capture_name = "UVC_Source"
default_capture_settings = {
"preferred_names": preferred_names,
"frame_size": (320, 240),
"frame_rate": 120,
}

default_plugins = [
# TODO: extend with plugins
default_capture_settings,
(default_capture_name, default_capture_settings),
("UVC_Manager", {}),
("NDSI_Manager", {}),
("HMD_Streaming_Manager", {}),
("File_Manager", {}),
# Detector needs to be loaded first to set `g_pool.pupil_detector`
(default_detector_cls.__name__, {}),
("PupilDetectorManager", {}),
Expand Down Expand Up @@ -413,6 +415,13 @@ def set_window_size():

g_pool.plugins = Plugin_List(g_pool, plugins_to_load)

if not g_pool.capture:
# Make sure we always have a capture running. Important if there was no
# capture stored in session settings.
g_pool.plugins.add(
g_pool.plugin_by_name[default_capture_name], default_capture_settings
)

g_pool.writer = None

# Register callbacks main_window
Expand Down
13 changes: 12 additions & 1 deletion pupil_src/launchables/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ def get_timestamp():
]
g_pool.plugin_by_name = {p.__name__: p for p in plugins}

default_capture_name = "UVC_Source"
default_capture_settings = {
"preferred_names": [
"Pupil Cam1 ID2",
Expand All @@ -305,9 +306,12 @@ def get_timestamp():
}

default_plugins = [
("UVC_Source", default_capture_settings),
(default_capture_name, default_capture_settings),
("Pupil_Data_Relay", {}),
("UVC_Manager", {}),
("NDSI_Manager", {}),
("HMD_Streaming_Manager", {}),
("File_Manager", {}),
("Log_Display", {}),
("Dummy_Gaze_Mapper", {}),
("Display_Recent_Gaze", {}),
Expand Down Expand Up @@ -573,6 +577,13 @@ def set_window_size():
g_pool, session_settings.get("loaded_plugins", default_plugins)
)

if not g_pool.capture:
# Make sure we always have a capture running. Important if there was no
# capture stored in session settings.
g_pool.plugins.add(
g_pool.plugin_by_name[default_capture_name], default_capture_settings
)

# Register callbacks main_window
glfw.glfwSetFramebufferSizeCallback(main_window, on_resize)
glfw.glfwSetKeyCallback(main_window, on_window_key)
Expand Down
3 changes: 3 additions & 0 deletions pupil_src/shared_modules/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ def __init__(self, g_pool, plugin_initializers):
expanded_initializers.append((plugin_by_name[name], name, args))
except KeyError:
logger.debug(f"Plugin {name} failed to load, not available for import.")

expanded_initializers.sort(key=lambda data: data[0].order)

# only add plugins that won't be replaced by newer plugins
for i, (plugin, name, args) in enumerate(expanded_initializers):
for new_plugin, new_name, _ in expanded_initializers[i + 1 :]:
Expand Down
5 changes: 5 additions & 0 deletions pupil_src/shared_modules/remote_recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

logger = logging.getLogger(__name__)

# Suppress pyre debug logs (except beacon)
logger.debug("Suppressing pyre debug logs (except zbeacon)")
logging.getLogger("pyre").setLevel(logging.WARNING)
logging.getLogger("pyre.zbeacon").setLevel(logging.DEBUG)


class Remote_Recording_State:
__slots__ = ["sensor"]
Expand Down
23 changes: 2 additions & 21 deletions pupil_src/shared_modules/video_capture/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,15 @@
InitialisationError,
StreamError,
)
from .fake_backend import Fake_Manager, Fake_Source
from .file_backend import File_Manager, File_Source, FileSeekError
from .hmd_streaming import HMD_Streaming_Source
from .uvc_backend import UVC_Manager, UVC_Source

logger = logging.getLogger(__name__)


source_classes = [File_Source, UVC_Source, Fake_Source, HMD_Streaming_Source]
manager_classes = [File_Manager, UVC_Manager, Fake_Manager]
source_classes = [File_Source, UVC_Source, HMD_Streaming_Source]
manager_classes = [File_Manager, UVC_Manager]

try:
from .ndsi_backend import NDSI_Source, NDSI_Manager
Expand All @@ -55,21 +54,3 @@
else:
source_classes.append(NDSI_Source)
manager_classes.append(NDSI_Manager)

try:
from .realsense_backend import Realsense_Source, Realsense_Manager
except ImportError:
logger.debug("Install pyrealsense to use the Intel RealSense backend")
else:
source_classes.append(Realsense_Source)
manager_classes.append(Realsense_Manager)

try:
from .realsense2_backend import Realsense2_Source, Realsense2_Manager
except ImportError:
logger.debug(
"Install pyrealsense2 to use the Intel RealSense backend for D400 series cameras"
)
else:
source_classes.append(Realsense2_Source)
manager_classes.append(Realsense2_Manager)
Loading

0 comments on commit b6c3a09

Please sign in to comment.