Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surfaces Revamp #1268

Merged
merged 170 commits into from
May 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
170 commits
Select commit Hold shift + click to select a range
da3e214
First commit with initial changes. Surface computation happens in und…
marc-tonsen Aug 14, 2018
96ed3e4
Improved a few variable names and fixed visualization to comply with …
marc-tonsen Aug 14, 2018
5ad9d7e
Optimize imports
marc-tonsen Aug 14, 2018
39a0862
Initial reimplementation of the surface tracker. Contains surface loc…
marc-tonsen Aug 17, 2018
2cbca01
Moved GUI into a separate file
marc-tonsen Aug 21, 2018
0ae0d65
Add new surface tracker to plugin list
marc-tonsen Aug 21, 2018
cf5e914
Moved vertex updates out of on_pos.
marc-tonsen Aug 21, 2018
9cb9212
Correctly save and load surface definitions from file.
marc-tonsen Aug 21, 2018
f177562
Surfaces are correctly loaded from file. camera_model is always reloa…
marc-tonsen Aug 24, 2018
60560f1
Switched to compute surface homographys with normalized image coordin…
marc-tonsen Aug 24, 2018
a9ad2dd
Save.
marc-tonsen Sep 18, 2018
1312fea
Calculate visualization in distorted space, calculate mapping of gaze…
marc-tonsen Sep 24, 2018
3f82393
Solve and clean up remaining TODO items
marc-tonsen Sep 24, 2018
ea31668
Minor changes.
marc-tonsen Sep 24, 2018
847e7c6
Apply BLACK standard
marc-tonsen Sep 25, 2018
44a9e36
Change homographys to be map between normalized surface coords and pi…
marc-tonsen Sep 27, 2018
5abe7c7
Update surface event API. Add copyright notices.
marc-tonsen Sep 27, 2018
dea3ca8
Fixed background logging issue by replacing zmq handler with a Stream…
marc-tonsen Sep 27, 2018
8cacaf7
Refactoring to accomodate offline surface tracker functionalities.
marc-tonsen Oct 1, 2018
42edb90
First draft of Offlin Surface Tracker
marc-tonsen Oct 4, 2018
b5255f6
Offline surfaces can be edited + full caching support
marc-tonsen Oct 8, 2018
9b4eaac
Remove debug output
marc-tonsen Oct 8, 2018
846310c
Correctly saving surface definitions and marker cache to file in offl…
marc-tonsen Oct 8, 2018
8d4e6b6
correctly saving surface caches and fixing a few bugs regarding saving
marc-tonsen Oct 10, 2018
9a55cf2
Clean up todos an unneccessary code
marc-tonsen Oct 10, 2018
c3b5290
Added heatmap calculation to offline surface tracker
marc-tonsen Oct 15, 2018
38c531e
Added Surface Tracker Interface and an explicit Online Surface Tracke…
marc-tonsen Oct 15, 2018
222f1f4
Unified calls to recent_events
marc-tonsen Oct 15, 2018
171cf76
Apply Black
marc-tonsen Oct 15, 2018
0b26a8c
prepend surface events with "surface_tracker" and apply Black
marc-tonsen Oct 15, 2018
427d80c
Improved imports, started introducing an abstract Surface class to ex…
marc-tonsen Oct 15, 2018
a5f0bc5
finish split between online and offline surfaces with a common parent…
marc-tonsen Oct 16, 2018
82263b8
Fix bug in inheritance of move_corner. Unify redundant bahvior on sur…
marc-tonsen Oct 16, 2018
b21a80d
Merge branch '1328_trim_mark_change_notification' into surfaces_revamp
marc-tonsen Oct 16, 2018
2f4c1c3
Update heatmaps on trim marker change
marc-tonsen Oct 16, 2018
0d6c5a8
Temporary adaptation of plugin imports
marc-tonsen Oct 16, 2018
a39d6f9
Initial draft of across surfaces heatmap feature
marc-tonsen Oct 16, 2018
3d35b90
Merge branch '1328_trim_mark_change_notification' into surfaces_revamp
marc-tonsen Oct 16, 2018
227aa1c
Removed redundant computation in heatmap calculation
marc-tonsen Oct 16, 2018
0983747
Fixed a bug where surfaces location caches are not correctly reset
marc-tonsen Oct 16, 2018
c6ec788
Save surface name on change
marc-tonsen Oct 16, 2018
a1204e1
Update in accordance to change in seek_control notification api
marc-tonsen Oct 16, 2018
ebece78
Merge branch '1328_trim_mark_change_notification' into surfaces_revamp
marc-tonsen Oct 16, 2018
b81b492
Remove old surface tracker plugin and remove "future" appendix from n…
marc-tonsen Oct 17, 2018
f67ac75
Fixing a few minor issues.
marc-tonsen Oct 17, 2018
7201660
Minor naming improvement. Actually delete old surface tracker files.
marc-tonsen Oct 17, 2018
97675a4
Merge branch 'master' into surfaces_revamp
marc-tonsen Oct 17, 2018
2eb469e
Map gaze onto surfaces in a background process.
marc-tonsen Oct 18, 2018
06e2ee1
Save changes in heatmap params on change.
marc-tonsen Oct 18, 2018
5978478
Save surface and heatmap parameters on change in online surface track…
marc-tonsen Oct 18, 2018
ce1964c
Minor improvement to add_surface syntax
marc-tonsen Oct 18, 2018
e0c38ff
Added export capabilities except for fixations on surface
marc-tonsen Oct 18, 2018
66bffa1
Added export capabilities except for fixations on surface
marc-tonsen Oct 18, 2018
c56fb6c
Make abstract classes actual ABC python classes
marc-tonsen Oct 19, 2018
c5c475c
minor bugfixes
marc-tonsen Oct 19, 2018
54ba2b5
minor bugfix
marc-tonsen Oct 19, 2018
efd02ca
fixed a bug when loading a recording containing online surface data
marc-tonsen Oct 19, 2018
b0336f1
Set marker minimum confidence to a more reasonable value + small bugf…
marc-tonsen Oct 19, 2018
a31f29e
Fixed gaze on surface export and added fixation on surface export. A …
marc-tonsen Oct 19, 2018
ba24e47
Automatically give incremental names to surfaces
marc-tonsen Oct 22, 2018
5a631c8
Use name of the corresponding surfaces as title for growing surfaces …
marc-tonsen Oct 22, 2018
8c14ed4
Slightly improve heatmap visualization and variable naming
marc-tonsen Oct 22, 2018
15d024e
Sale smoothness of heatmaps independently from the surface size. Sani…
marc-tonsen Oct 22, 2018
32fee4b
Enforce unique surface names
marc-tonsen Oct 22, 2018
7100636
remove uid everywhere except in __hash__ and __eq__ computation.
marc-tonsen Oct 22, 2018
983200d
Improve timeline visualization of marker cache
marc-tonsen Oct 22, 2018
e90f2fb
Revert background logger changes handled in a separate PR
marc-tonsen Oct 22, 2018
afb40cd
Fixed typos
marc-tonsen Oct 22, 2018
e5485b4
Move marker detection parameters into separate growing menu
marc-tonsen Oct 22, 2018
7381481
Fixed a bug with the add surface thumb
marc-tonsen Oct 22, 2018
4c255a0
Implement freeze feature
marc-tonsen Oct 22, 2018
8e370a6
Remove stop tracking feature
marc-tonsen Oct 22, 2018
0bb8fb8
Make heatmap smoothness parameter scale exponentially
marc-tonsen Oct 23, 2018
9f9bd6a
Remap gaze on gaze_positions_changed notification
marc-tonsen Oct 23, 2018
2701429
Tune colors to increase contrast slightly
marc-tonsen Oct 23, 2018
42cd54c
Improve visualization of toggled surface buttons
marc-tonsen Oct 23, 2018
47780c9
Tuned surface menu tex
marc-tonsen Oct 23, 2018
eea0d39
Remove old todos
marc-tonsen Oct 23, 2018
e7e397e
Minor color tuning for surface buttons and text
marc-tonsen Oct 23, 2018
114c3bb
Disambiguate naming of marker vertices in surface vs image space
marc-tonsen Oct 23, 2018
6ba7952
Remove old todos
marc-tonsen Oct 23, 2018
44f1a47
Fixed a lot of small code style issues and typos
marc-tonsen Oct 23, 2018
1d943a3
Remove old todos
marc-tonsen Oct 23, 2018
2a2cc30
Merge branch 'master' into surfaces_revamp
marc-tonsen Oct 23, 2018
04cecec
Improve method order in Surface
marc-tonsen Oct 24, 2018
a36caa0
Improve method order in Surface and refactoring method names
marc-tonsen Oct 24, 2018
945ed0a
Improved docs and naming around Surface and Surface_Offline
marc-tonsen Oct 24, 2018
8a76ed2
Unified update_heatmap functions in all Surface classes
marc-tonsen Oct 24, 2018
2a5adc3
Small changes to surface docstrings
marc-tonsen Oct 24, 2018
129df74
Improved Surface_Tracker method order and privacy states.
marc-tonsen Oct 24, 2018
0077160
small bug fix
marc-tonsen Oct 24, 2018
ec849ae
Improve method surface_tracker_offline method order and privacy states
marc-tonsen Oct 24, 2018
553f843
change lambda-definition to proper def-definition
marc-tonsen Oct 24, 2018
8cee58c
Improve method order in surface_tracker_online
marc-tonsen Oct 24, 2018
80f326c
Remove old todos
marc-tonsen Oct 24, 2018
a66c6cd
Add a todo
marc-tonsen Oct 25, 2018
c3604ea
Improvee _Surface_Marker_Aggregate docstring
marc-tonsen Oct 26, 2018
2ddb0af
Optimize gui imports and handling of freeze feature
marc-tonsen Oct 26, 2018
de6ab91
Improve display of markers that are detected but do not make it throu…
marc-tonsen Oct 26, 2018
fa3c6bd
Improve variable naming.
marc-tonsen Oct 26, 2018
10af781
extracted sub methods from _draw_surface_menu
marc-tonsen Oct 26, 2018
404f57d
Improved variable naming, and extracted sub methods from on_click
marc-tonsen Oct 26, 2018
dc4f0d4
extract button click radius into a variable.
marc-tonsen Oct 26, 2018
e9b63fa
Renaming and extraction in Surface_Window
marc-tonsen Oct 26, 2018
780c289
make naming in exports slightly more explicit
marc-tonsen Oct 29, 2018
771e4a1
Extract multiple declarations of norm_corners into a class attribute
marc-tonsen Oct 30, 2018
1316fb0
Fixed a bug where some values were wrongly edited in place
marc-tonsen Oct 30, 2018
2390a20
Extract redundant code in map_to_surf and map_from_surf into method
marc-tonsen Oct 30, 2018
90c3390
improve naming of map_events to map_gaze_and_fixation_events
marc-tonsen Oct 30, 2018
c3947da
Defined a Surface_Location class and used that to wrap homography val…
marc-tonsen Oct 30, 2018
8b6ff06
Fixed a bug where offline surface tracker visualizes duplicate marker…
marc-tonsen Oct 30, 2018
31b4710
Write out acronyms for clarity
marc-tonsen Oct 30, 2018
43aad46
Clarifying a few complex points with comments.
marc-tonsen Oct 30, 2018
2e05644
Renamed variables that were wrongly missed in a previous renaming. Fi…
marc-tonsen Oct 30, 2018
1432c6b
Some renaming and deletion of code that is no longer used.
marc-tonsen Oct 30, 2018
a6a012e
improved docstring and naming of _finalize_def
marc-tonsen Oct 30, 2018
0d1357e
Extracted redundant code into a separate method.
marc-tonsen Oct 30, 2018
425276e
Extracted redundant code into a separate method and fixed a bug were …
marc-tonsen Oct 30, 2018
3eedba8
Improved naming of dummy heatmap generating methods.
marc-tonsen Oct 30, 2018
82c5cde
Fixed a bug in heatmap dummt generation.
marc-tonsen Oct 30, 2018
c981fac
Extracting a few methods for readability
marc-tonsen Nov 5, 2018
d55c69a
Fixed a bug in loading saved surface location caches. Also moved seri…
marc-tonsen Nov 5, 2018
81e7476
Changed values to be overwritten by child classes to abstract properties
marc-tonsen Nov 5, 2018
3273959
Rename method and add clarifying comment.
marc-tonsen Nov 5, 2018
5698ee4
Minor refactoring to improve readability.
marc-tonsen Nov 5, 2018
6f211eb
Change remove_surface to take surface as argument rather than the ind…
marc-tonsen Nov 5, 2018
01acc7c
Make Surface_Class abstract property
marc-tonsen Nov 5, 2018
3037cd7
Several variable renamings to improve readability.
marc-tonsen Nov 5, 2018
043bbcc
Several variable renamings to improve readability.
marc-tonsen Nov 5, 2018
76d0c25
Fixed a bug in gaze across surfaces heatmap computation.
marc-tonsen Nov 5, 2018
42b1008
Improve naming for readability.
marc-tonsen Nov 5, 2018
4527e2c
Improve naming for readability.
marc-tonsen Nov 5, 2018
09764e9
Extracted methods from save_surface_statsics_to_file to increase read…
marc-tonsen Nov 5, 2018
291b777
Fixed a typo
marc-tonsen Nov 5, 2018
4d2ca22
Added a comment
marc-tonsen Nov 5, 2018
ce2772c
Minor renaming and cleanup
marc-tonsen Nov 5, 2018
8a5a4dd
Minor refactoring and small bugfixes
marc-tonsen Nov 6, 2018
3b8f994
minor improvements
marc-tonsen Nov 6, 2018
88f1a99
Splitting add_surface into two separate methods: ui callback and add …
marc-tonsen Nov 6, 2018
7812b2c
Move cache_list into surface tracker. Minor renaming.
marc-tonsen Nov 6, 2018
59727c8
Fixed a bug in back ground gaze mapping to surface
marc-tonsen Nov 7, 2018
1e82015
Extracted methods for readability
marc-tonsen Nov 7, 2018
74f02f2
Improved docstrings
marc-tonsen Nov 7, 2018
c509657
Merge branch 'master' into surfaces_revamp
marc-tonsen Nov 7, 2018
7f87823
Switch to IPC_Logging_Task_Proxy
marc-tonsen Nov 7, 2018
3242213
Saving surface image as well
marc-tonsen Nov 7, 2018
4f4bf4e
Deleted feature for saving surface images.
marc-tonsen Nov 7, 2018
79bee56
Moved exporter into separate class that does everything in the backgr…
marc-tonsen Nov 9, 2018
7bc0b7a
Moved cache_list to surface tracker and refactored it. Use None as no…
marc-tonsen Nov 12, 2018
98f985c
Do not plot intermediate heatmaps, wait until gaze mapping is fully c…
marc-tonsen Nov 12, 2018
1119ac8
Remove old todo
marc-tonsen Nov 12, 2018
e476cf7
Enabled Across Surfaces Heatmaps in Capture too.
marc-tonsen Nov 16, 2018
3da005e
Added a comment explaining why we change context to fork.
marc-tonsen Nov 21, 2018
519704a
added initial version of update_recording_v19_v110
marc-tonsen Nov 26, 2018
046601a
Finalized update_recording_v19_v110
marc-tonsen Nov 26, 2018
d8c5729
Add visualization of deprecation state of old surface definitions.
marc-tonsen Nov 26, 2018
f9bdd61
move definitions out of __init__
marc-tonsen Nov 26, 2018
6b62e79
Added deprecation visualization to surface title
marc-tonsen Nov 26, 2018
6674975
Adds surface deprecation warning
marc-tonsen Nov 26, 2018
3b19760
optimized imports
marc-tonsen Nov 26, 2018
c80891e
surface_tracker.offline_utils: Convert inner functions to callable class
papr Nov 30, 2018
2644d76
Prepare Surface_Offline for pickling by removing unpicklable properties
romanroibu May 3, 2019
ae0bc0d
Update file_methods._FrozenDict to subclass abstract Mapping class an…
romanroibu May 3, 2019
90b9be0
Merge branch 'master' into marc_surfaces_revamp
papr May 24, 2019
493cc58
Re-add surface definition update code
papr May 24, 2019
5481aed
Fix surface tracker for macOS
papr May 24, 2019
5d98233
Task_Proxy: Allow to specify multiprocessing context
papr May 24, 2019
c8ee2a7
Offlien Surface Tracker: Consistent multiprocessing context usage
papr May 27, 2019
968d9cb
Offline Surface Tracker: Small improvements
papr May 27, 2019
82d8d7c
Give multiprocessing context an explicit name
papr May 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pupil_src/launchables/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def player(rec_dir, ipc_pub_url, ipc_sub_url, ipc_push_url, user_dir, app_versio

# from vis_scan_path import Vis_Scan_Path
from seek_control import Seek_Control
from offline_surface_tracker import Offline_Surface_Tracker
from surface_tracker import Surface_Tracker_Offline

# from marker_auto_trim_marks import Marker_Auto_Trim_Marks
from fixation_detector import Offline_Fixation_Detector
Expand Down Expand Up @@ -146,7 +146,7 @@ def player(rec_dir, ipc_pub_url, ipc_sub_url, ipc_push_url, user_dir, app_versio
Offline_Fixation_Detector,
Offline_Eye_Movement_Detector,
Offline_Blink_Detection,
Offline_Surface_Tracker,
Surface_Tracker_Offline,
Raw_Data_Exporter,
Annotation_Player,
Log_History,
Expand Down
4 changes: 2 additions & 2 deletions pupil_src/launchables/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def set_detection_mapping_mode(new_mode):
from time_sync import Time_Sync
from pupil_remote import Pupil_Remote
from pupil_groups import Pupil_Groups
from surface_tracker import Surface_Tracker
from surface_tracker import Surface_Tracker_Online
from log_display import Log_Display
from annotations import Annotation_Capture
from log_history import Log_History
Expand Down Expand Up @@ -227,7 +227,7 @@ def get_timestamp():
Frame_Publisher,
Pupil_Remote,
Time_Sync,
Surface_Tracker,
Surface_Tracker_Online,
Annotation_Capture,
Log_History,
Fixation_Detector,
Expand Down
10 changes: 6 additions & 4 deletions pupil_src/shared_modules/background_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,21 @@ class EarlyCancellationError(Exception):
class Task_Proxy:
"""Future like object that runs a given generator in the background and returns is able to return the results incrementally"""

def __init__(self, name, generator, args=(), kwargs={}):
def __init__(self, name, generator, args=(), kwargs={}, context=...):
super().__init__()
if context is ...:
context = mp.get_context()

self._should_terminate_flag = mp.Value(c_bool, 0)
self._should_terminate_flag = context.Value(c_bool, 0)
self._completed = False
self._canceled = False

pipe_recv, pipe_send = mp.Pipe(False)
pipe_recv, pipe_send = context.Pipe(False)
wrapper_args = self._prepare_wrapper_args(
pipe_send, self._should_terminate_flag, generator
)
wrapper_args.extend(args)
self.process = mp.Process(
self.process = context.Process(
target=self._wrapper, name=name, args=wrapper_args, kwargs=kwargs
)
self.process.daemon = True
Expand Down
134 changes: 0 additions & 134 deletions pupil_src/shared_modules/cache_list.py

This file was deleted.

42 changes: 30 additions & 12 deletions pupil_src/shared_modules/camera_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def load_intrinsics(directory, cam_name, resolution):

intrinsics = calib_dict[str(resolution)]
logger.info("Previously recorded calibration found and loaded!")
except Exception as e:
except Exception:
logger.info(
"No user calibration found for camera {} at resolution {}".format(
cam_name, resolution
Expand Down Expand Up @@ -213,7 +213,6 @@ def save_intrinsics(directory, cam_name, resolution, intrinsics):


class Camera_Model(abc.ABC):

@abc.abstractmethod
def undistort(self, img: np.ndarray) -> np.ndarray:
...
Expand All @@ -235,7 +234,15 @@ def projectPoints(
...

@abc.abstractmethod
def solvePnP(self, uv3d, xy):
def solvePnP(
self,
uv3d,
xy,
flags: int = cv2.SOLVEPNP_ITERATIVE,
useExtrinsicGuess: bool = False,
rvec: typing.Optional[np.ndarray] = None,
tvec: typing.Optional[np.ndarray] = None,
):
...

@abc.abstractmethod
Expand Down Expand Up @@ -373,6 +380,16 @@ def projectPoints(self, object_points, rvec=None, tvec=None, use_distortion=True
image_points.shape = (-1, 1, 2)
return image_points

def undistortPoints(self, points):
points = self.unprojectPoints(points, use_distortion=True)
points = self.projectPoints(points, use_distortion=False)
return points

def distortPoints(self, points):
points = self.unprojectPoints(points, use_distortion=False)
points = self.projectPoints(points, use_distortion=True)
return points

def solvePnP(
self,
uv3d,
Expand Down Expand Up @@ -416,12 +433,6 @@ def solvePnP(

return res

def undistortPoints(self, xy):
xy_undist = cv2.fisheye.undistortPoints(
xy, self.K, self.D, R=np.eye(3), P=self.K
)
return xy_undist

def save(self, directory, custom_name=None):
"""
Saves the current calibration to corresponding camera's calibrations file
Expand Down Expand Up @@ -533,6 +544,16 @@ def projectPoints(self, object_points, rvec=None, tvec=None, use_distortion=True
image_points.shape = (-1, 1, 2)
return image_points

def undistortPoints(self, points):
points = self.unprojectPoints(points, use_distortion=True)
points = self.projectPoints(points, use_distortion=False)
return points

def distortPoints(self, points):
points = self.unprojectPoints(points, use_distortion=False)
points = self.projectPoints(points, use_distortion=True)
return points

def solvePnP(
self,
uv3d,
Expand Down Expand Up @@ -563,9 +584,6 @@ def solvePnP(
)
return res

def undistortPoints(self, xy):
return cv2.undistortPoints(xy, self.K, self.D)

def save(self, directory, custom_name=None):
"""
Saves the current calibration to corresponding camera's calibrations file
Expand Down
1 change: 1 addition & 0 deletions pupil_src/shared_modules/file_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""

import collections
import collections.abc
import logging
import os
import pickle
Expand Down
Loading