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

Surfaces Revamp #1268

merged 170 commits into from
May 27, 2019

Conversation

marc-tonsen
Copy link
Contributor

@marc-tonsen marc-tonsen commented Aug 14, 2018

The surface tracking feature needs a lot of refactoring and a few bug fixes and enhancements.

Progress:

@papr papr added this to the v1.9 milestone Aug 16, 2018
@marc-tonsen
Copy link
Contributor Author

marc-tonsen commented Sep 24, 2018

I pushed a first more or less complete refactor of the Online Surface Tracker.

One issue with surface tracking is camera undistortion. The undistortion function that is defined by the camera intrinsics is only correct inside the bounds of the image. However parts of the surface may lie outside of the image. Given the location of the surface corner outside of the image in undistorted image space, it is impossible for us to correctly compute it's location in distorted image space for visualization. This problem also occurs inside of the image in the very corners.

In the previous version of the surface tracker this problem was not solved, i.e. the visualization was broken if one or more corners of the surface lie outside of the image.
In this version this problem is solved by saving the surface definition in both distorted and undistorted image space. For visualization the version in distorted image space is used, so we never have to undistort. For mapping gaze onto the surface the undistorted version is used to ensure a correct mapping to surface coordinates. The underlying assumption is that the gaze point will always be inside of the image, so it's undistortion is possible.

The refactored version is contained in a new plugin called Surface Tracker Future and the according code is contained in separate module folder in shared_modules. I'd like to receive a first round of feedback / tests before moving on extending this to offline surface tracking.

I droped the 3D localization feature in this version to save time. Since we plan to replace this with a separate and more capable plugin I decided to skip it for now. What do you think about that?

@marc-tonsen
Copy link
Contributor Author

Currently the homographys output by the surface tracker transform normalized surface coordinates into normalized image coordinates. This makes it difficult to directly use the homographys in e.g. OpenCV to transform an image, which requires the image coordinates to be in pixels. Therefore I propose to switch to transformations between normalized surface coordinates and pixel image coordinates.

@marc-tonsen
Copy link
Contributor Author

Some of the surface related naming is currently inconsistent/not very descriptive, therefore I propose the following changes. What do you think @papr ?

Goals of renaming:

  • make "surf" the consistent acronym for surface
  • in filenames always write out surface, no acronym
  • remove "screen" from names, as surfaces are not necessarily screens, replace with "surf"
  • Make column names consistent across exported files

Changes in Surface Event API:

gaze_on_srf -> gaze_on_surf
fixations_on_srf -> fixations_on_surf
m_to_screen -> surf_to_img_trans
m_from_screen -> img_to_surf_trans

In 'gaze_positions_on_surface_<surface_name>_<surface_id>.csv' file:

world_frame_idx -> world_idx
on_srf -> on_surf

In 'fixations_on_surface_<surface_name>_<surface_id>.csv' file:
on_srf -> on_surf

In 'srf_positions_<surface_name>_<surface_id>.csv' file:

'srf_positions_<surface_name>_<surface_id>.csv' -> 'surface_detections_<surface_name>_<surface_id>.csv'
frame_idx -> world_idx
timestamp -> world_timestamp
m_to_screen -> surf_to_img_trans
m_from_screen -> img_to_surf_trans

In 'surface_events.csv' file:

frame_number -> world_idx
timestamp -> world_timestamp

!!! This file is not part of the surface tracker exports !!!

In 'gaze_positions.csv' file:
index -> world_idx

!!! This file is not part of the surface tracker exports !!!

In 'pupil_positions.csv' file:
index -> world_idx

@papr papr modified the milestones: v1.10, v1.11 Dec 5, 2018
@papr papr modified the milestones: v1.11, v1.12 Feb 20, 2019
@papr papr force-pushed the surfaces_revamp branch from c2d103c to 5481aed Compare May 24, 2019 10:01
@papr papr modified the milestones: v1.12, v1.13 May 24, 2019
@papr papr requested a review from romanroibu May 27, 2019 08:38
@papr
Copy link
Contributor

papr commented May 27, 2019

@romanroibu Could you please review the last two commits. Afterwards, I would merge and we can start creating incremental PRs.

@papr papr requested a review from romanroibu May 27, 2019 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API changes Indicates issues and prs that either change the zmq or plugin api, or the export format.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants