behinger / etcomp

Project to compare different eyetrackers
MIT License
34 stars 7 forks source link

Modifying surface detection function #33

Open rrrliu opened 4 years ago

rrrliu commented 4 years ago

Hey!

I'm working on a project involving Pupil Labs eye movement detection, but with three screens instead of just one screen. Which function(s) should I modify to make this change?

Also, I was wondering what the requirements were for markers – can we use tag36h11 markers (as recommended by Pupil Labs here https://docs.pupil-labs.com/core/software/pupil-capture/#surface-tracking)?

Thanks a ton, Richard

behinger commented 4 years ago

hey! new marker: The trouble here is that you would need to update your pupil labs version. As pupil lab constantly changes their API & internal code, this can be challenging. E.g. a while back they completly changed how they read in files, I adapted to those changes in the pupil_dev branch. You are more than welcome to try to adapt things to the newest version.

multiple surfaces I'm not aware that pupil labs can natively do this. In this version of pupil labs, the key line to detect surfaces is: https://github.com/behinger/etcomp/blob/master/code/functions/pl_surface.py#L79, but I think they updated their surface mapping some months ago and rewrote it from scratch. Unfortunately this was after we settled on this pupil labs version. It might be worth checking out.

Hope that helps at least a bit. You could contact pupil labs on this and they will help you out. Best, Bene

rrrliu commented 4 years ago

Hi Bene,

Thank you so much for your help! I just wanted to follow up on a couple things regarding multiple surface detection. So far, I wrote a separate function for building and saving three screens and it's been able to accurately detect those screens based on marker IDs. However, I ran into an issue at the gaze_on_srf_in_section() function in offline_reference_surface.py. For all the surfaces I've defined, self.cache is None, so it's always returning an empty list.

I was wondering if you could provide any insight into why the cache is always None? I think the issue might be that I commented out this line https://github.com/behinger/etcomp/blob/deb34df5976f7442240abfc29678f928e379c7d9/code/functions/pl_surface.py#L116 (since I was initializing tracker.cache with a third-party marker detection function), but I'm not sure. What is the purpose of the init_cache function, and does it relate to the issue of the surface cache being None?

Best, Richard

behinger commented 4 years ago

Hi Richard, Puh, its been such a long time. I think surface.cache should not be empty. If I remember correctly this should be the field where the actual surface definition lives in. I dont have a shell available atm, but I think the content of self.cache ultimately should be something like this: {'detected':detected,'detected_markers':len(overlap),'m_from_undistored_norm_space':m_from_undistored_norm_space,'m_to_undistored_norm_space':m_to_undistored_norm_space,'m_from_screen':m_from_screen,'m_to_screen':m_to_screen,'camera_pose_3d':camera_pose_3d}

Taken from reference_surface._get_location, which is called via answer_caching_request at init_cache

Does that help already? How does your tracker.cache look like? Also there is a marker.cache and a surface.cache if I remember correctly.