pupil-labs / hmd-eyes

Building blocks for eye tracking in AR and VR.
GNU Lesser General Public License v3.0
152 stars 64 forks source link

Receive pupil data from both eyes simultaneously #106

Closed ruw001 closed 2 years ago

ruw001 commented 2 years ago

I'm using the HTC Vive VR add-on with Unity. From my understanding, with pupil listener, I can get pupil data for only one eye at a time, determined by the eyeID, but is there a way that I can get the data for both eyes simultaneously? If not, is there any way I can align left eye data with right eye data?

CrazyDave4 commented 2 years ago

Here's what I did:

void ReceivePupilData(PupilData pupilData) { if (pupilData.EyeIdx == 0) { pd0 = pupilData.Diameter; ...... } if (pupilData.EyeIdx == 1) { pd1 = pupilData.Diameter; ...... } (You have pd0 and pd1 here) }

ruw001 commented 2 years ago

Thanks @CrazyDave4 ! I'm able to get the data from either eye 0 or eye 1, one at a time. What I wanted to do is to synchronize the data from 2 eyes in real time. Currently I can only synchronize the data post-hoc.

papr commented 2 years ago

@ruw001 Check out the pupilData.PupilTimestampproperty. You can use the timestamps to find and match pupil samples that are close in time. Since the eye cameras run independently of each other, the eye sample timestamps do usually not match perfectly.