🥽 core-xr


user-73b616 01 November, 2021, 09:46:42

Are there any tips or tricks how to improve 3d sphere center coordinates (camera coordinate space)? Even with optimal pupil detection these coordinates jumps ~2mm mainly on Z axis. Is this expected precision of 3d eye model?

papr 01 November, 2021, 09:52:00

Position on Z-axis is the most difficult to estimate. I think that the 2mm could be normal but I can't tell from the top of my head what the expected variance is

papr 01 November, 2021, 09:50:02

If the model is well fit, it should be fairly stable. You can also freeze it in place.

user-73b616 01 November, 2021, 09:54:26

thank you, I mean for gaze estimation this does not seem to matter at all but I was trying to use 3D model data for rendering adjustments where I would need to get below 1mm

papr 01 November, 2021, 15:13:27

pye3d needs to trade off accuracy with recency. The more data you collect, the more accurate the location estimate will be. The longer you collect, the more out-dated might the model be already, e.g. due to slippage. Here you can read about it https://docs.pupil-labs.com/developer/core/pye3d/#pye3d-pupil-detection

user-d1efa8 04 November, 2021, 14:52:16

@papr can I DM you or should I just ask my question here? It’s about going in-depth about how the hmd add-on does calibration

user-b14f98 14 November, 2021, 16:43:47

@papr I can confirm the left/right flip in the intrinsic matrix. I am working on understanding the compression. That's a strange one! FWIW, the intrinsic matrix saved to file seems equivalent to the intrinsic parameters associated with the "physical camera" game object Unity, and shown in the inspector.

user-b14f98 14 November, 2021, 16:49:44

Actually, maybe not.

user-b14f98 14 November, 2021, 16:50:20

Here's a snapshot of the screencast cam's properties in inspector

Chat image

user-b14f98 14 November, 2021, 16:50:43

For a sensor size of 320 by 240, and vertFOV of 60, the focal length is 207.8

user-b14f98 14 November, 2021, 16:51:14

Here is your matrix:

array([[415.69219971, 0. , 320. ], [ 0. , 415.69219971, 240. ], [ 0. , 0. , 1. ]])

user-b14f98 14 November, 2021, 16:52:11

Either the focal length should be 207.8, or the principal point should be 160 x 120. Right?

user-b14f98 14 November, 2021, 17:00:23

No, that doesn't make sense. The size of the offset is not nearly the magnitude I would expect from 2x the focal distance.

user-73b616 14 November, 2021, 18:00:19

I believe that camera sensor size in unity is not in pixels but in mm so 320 240 seems to be nonsense

user-73b616 14 November, 2021, 18:08:30

not sure where is the camera matrix from but given the values I would expect that it is valid for resolution 640x480 and those are just dummy values where only focal length is manually set to some reasonable value bcs pupil software uses only that (fx+fy)/2 => that's why fx == fy and there is no way that some real world camera matrix would have values like that

user-b14f98 14 November, 2021, 18:13:56

I'm also suspicious, and looking into it now. I don't think the focal length is set correctly.

user-73b616 14 November, 2021, 18:15:14

those are set approximately for their camera modules, if you want precise values just calibrate the camera yourself

papr 14 November, 2021, 18:16:27

This is about the camera intrinsics that we are reading from unity's main camera

user-73b616 14 November, 2021, 18:17:04

oh sorry, seemed like camera_modules.py related

papr 14 November, 2021, 18:18:33

No worries, it is. We are trying to find out if hmd-eyes is using the correct intrinsics

user-b14f98 15 November, 2021, 03:00:22

@papr An issue with my notes - I can't find where the eye translations are set for the hmd gazer. Can you please point me to a line number?

user-b14f98 15 November, 2021, 19:09:16

Found the issue - it was the wrong fork / branch.

user-d1efa8 16 November, 2021, 16:11:48

@papr do u know if you play around with any camera projection matrix (matrices) in unity or use it in calibration calculations ?

user-d1efa8 16 November, 2021, 16:12:32

As far as I can see in the code I don’t think you do …(?)

papr 16 November, 2021, 16:12:50

I would guess so, but I am not sure

user-d1efa8 16 November, 2021, 16:22:09

I feel like the code assumes whatever standard projection matrix unity uses or something like that, but in our setup we actually have two different projection matrices per eye, so we wanted to try taking the dot product between the reference point and those projection matrices

user-d1efa8 16 November, 2021, 16:23:40

I’d do it thru unity but we can only send one reference point for both eyes , and I see where I’d make changes in the Python scripts but I’m not sure how difficult it would be to do that and make sure pupil capture still runs

papr 16 November, 2021, 16:24:57

Correct, you would need a custom hmd calibration choreography that is able to differentiate the ref data for each eye and then creates a dual monocular gazer.

user-d1efa8 16 November, 2021, 16:27:21

But what if I differentiate within the Python code instead ? There’s already different variables and results per eye so if I just apply the transformations in the right place it should still work right ? (Maybe?)

papr 16 November, 2021, 16:27:59

I was only talking about the Python code. The unity code would need adjustments as well

user-d1efa8 16 November, 2021, 16:33:25

How so?

papr 16 November, 2021, 16:48:08

Well, you seem to want to send different reference locations for each eye, correct? You will need to adjust the unity code to do so. But thinking about it, hmd-eyes only sends the 3d location of the reference location. There is no need to project it into a plane.

user-d1efa8 16 November, 2021, 16:56:04

That’s what I was thinking too, but I’m not sure what else could be causing that radial offset we’re seeing in our data

user-d1efa8 16 November, 2021, 16:58:42

Also, I’m trying to transform 3D coordinates to a different 3D coordinate…like, the camera center is offset per eye, and the offset per eye is equal and opposite

user-d1efa8 16 November, 2021, 17:03:40

This

Chat image

papr 16 November, 2021, 17:04:57

Can you please remind me: Do you use Realtime or Post-hoc calibration? And what data are you comparing?

user-d1efa8 16 November, 2021, 17:36:39

Real-time, also uh….comparing data collected from what we’re doing now and then data from (ideally) after applying those transformations

papr 16 November, 2021, 18:03:39

But are you comparing the 3d reference data to the gaze_point_3d values?

user-d1efa8 16 November, 2021, 18:06:10

Oh, yes yes

user-d1efa8 19 November, 2021, 19:27:49

@papr if I’m trying to plot the gaze for one eye, should I do (for example) eye0_normal - eye0_center ?

user-b14f98 22 November, 2021, 18:04:17

@papr I recently had a data collection failure, and the log file is interesting, and full of issues, but uninformative error messages. I wonder if you could have a quick look and tell me if you recognize the underlying issue?

user-b14f98 22 November, 2021, 18:04:46

https://drive.google.com/file/d/16hR_kvx0uJXV4cBkCKsDCFxUkMpThzpG/view?usp=sharing

papr 22 November, 2021, 20:25:31

Interestingly, this recording was not stopped due to this issue. No case of "Non-monotonic timestamps"

user-b14f98 22 November, 2021, 18:06:09

Interesting logs include:

user-b14f98 22 November, 2021, 18:06:11

2021-11-18 10:38:32,490 - world - [ERROR] recorder: Notification without timestamp will not be saved.

papr 22 November, 2021, 18:16:01

Are you sending annotations to Capture? If so, please include a timestamp.

user-b14f98 22 November, 2021, 18:06:26

2021-11-18 10:40:56,680 - eye0 - [DEBUG] glfw: (65544) b'Win32: Failed to open clipboard: Access is denied. '

papr 22 November, 2021, 18:18:16

This one happens from time to time. Not sure what the underlying issue is. They should not affect the recording.

user-b14f98 22 November, 2021, 18:06:48

and LOTS of 2021-11-18 10:45:00,575 - world - [DEBUG] network_api.controller.pupil_remote_controller: Request: 't', Response: '650859.914927'

user-b14f98 22 November, 2021, 18:07:50

I can dig up some timestamps to tell you when recording failed...

user-b14f98 22 November, 2021, 18:15:01

Shortly after 672476.7406.

user-b14f98 22 November, 2021, 18:16:18

No, I'm not sending annotations.

papr 22 November, 2021, 18:17:33

ok, just remembered that annotations != notifications

user-b14f98 22 November, 2021, 18:17:38

It looks like these are the logs returned at the time of failure:

user-b14f98 22 November, 2021, 18:17:53

2021-11-18 16:45:17,401 - world - [DEBUG] network_api.controller.pupil_remote_controller: Request: 't', Response: '672476.740555' 2021-11-18 16:45:17,412 - world - [DEBUG] network_api.controller.pupil_remote_controller: Request: 't', Response: '672476.751806' 2021-11-18 16:45:26,890 - eye1 - [DEBUG] glfw: (65544) b'Win32: Failed to open clipboard: Access is denied. ' 2021-11-18 16:45:34,307 - eye1 - [DEBUG] glfw: (65544) b'Win32: Failed to open clipboard: Access is denied. ' 2021-11-18 16:45:34,806 - eye1 - [DEBUG] glfw: (65544) b'Win32: Failed to open clipboard: Access is denied.

papr 22 November, 2021, 18:18:57

The t request should not have an affect either. On the other side, you are sending a lot of them. I wonder if they are too many and somehow affect the recording process.

user-b14f98 22 November, 2021, 18:19:22

What kind of c# code produced the 't' request?

user-b14f98 22 November, 2021, 18:19:37

For context, I'm using the UXF "Unity Experimental Framework" to automate data logging.

papr 22 November, 2021, 18:19:38

Time sync related stuff

user-b14f98 22 November, 2021, 18:21:06

UXF is not setup to interface iwth Pupil Labs - I designed that part, and perhaps something I did is problematic

papr 22 November, 2021, 18:21:11

I recommend calling UpdateTimeSync() from time to time instead, and then using ConvertToPupilTime(Time.realtimeSinceStartup) for high frequency timestamp measurements

user-b14f98 22 November, 2021, 18:22:28

Yes, I was calling: "gameObject.GetComponent<TimeSync>().GetPupilTimestamp().ToString()"

user-b14f98 22 November, 2021, 18:22:32

Probably VERY frequently.

user-b14f98 22 November, 2021, 18:22:39

(every frame)

papr 22 November, 2021, 18:22:58

That should have generated noticable lag on your end

user-b14f98 22 November, 2021, 18:23:06

That's good to know 🙂

user-b14f98 22 November, 2021, 18:23:19

It didn't, but was probably running as a thread or subprocess

user-b14f98 22 November, 2021, 18:24:36

That the only red flag you see?

papr 22 November, 2021, 18:24:59

Yes.

user-b14f98 22 November, 2021, 18:25:08

Ok, thanks very much for the insight!

user-b14f98 22 November, 2021, 20:15:53

Another issue: 2021-11-22 15:06:13,139 - world - [DEBUG] recorder: Non-monotonic timestamps!Last timestamp: -832549.9458979922. Given timestamp: -832549.9522260039

user-b14f98 22 November, 2021, 20:16:17

This killed the recording - lost another participant. (We're pilot testing)

user-b14f98 22 November, 2021, 20:16:37

I did impelement the changes you suggested earlier today.

papr 22 November, 2021, 20:18:21

It stops the recording yes, but the recording should be intact.

papr 22 November, 2021, 20:19:02

Do you have the time sync plugin activated?

user-b14f98 22 November, 2021, 20:19:12

Yes, but let's just say that this kind of unpredictable behavior will make analysis very difficult.

user-b14f98 22 November, 2021, 20:19:20

Hurmn. I don't know that I do.

user-b14f98 22 November, 2021, 20:19:30

This is on the capture side - a plugin to be enabled via gui?

papr 22 November, 2021, 20:20:28

Yes. But it is unlikely you have it enabled if you do not need it.

user-b14f98 22 November, 2021, 20:20:43

Ok. Let me check...

user-b14f98 22 November, 2021, 20:20:50

You want it enabled, I imagine.

papr 22 November, 2021, 20:21:15

The opposite.

papr 22 November, 2021, 20:21:33

I want anything disabled that plays with the Pupil clock.

user-b14f98 22 November, 2021, 20:21:59

btw using 3.4.0

user-b14f98 22 November, 2021, 20:22:23

It was disabled

papr 22 November, 2021, 20:23:19

Can you check if you use the T remote command anywhere? https://github.com/pupil-labs/hmd-eyes/blob/master/plugin/Scripts/TimeSync.cs#L84 (unlikely based on the shared timestamps)

user-b14f98 22 November, 2021, 20:24:47

nope

user-b14f98 22 November, 2021, 20:24:58

I don't. My code is very minimal.

user-b14f98 22 November, 2021, 20:26:00

Yes, this is a new recording, and a new log

user-b14f98 22 November, 2021, 20:26:07

and, apparently, a new issue 😛

user-b14f98 22 November, 2021, 20:26:21

I can share the new log. one second!

user-b14f98 22 November, 2021, 20:27:36

When it failed, I manually restarted recording by clicking R

papr 22 November, 2021, 20:31:56

No indication of what caused the non-monotonic timestamp. If we are unlucky this is caused by ~~something internally in the camera~~. The monotonicity test was implemented in case someone explicitly changes the Pupil clock during a recording. But this does not seem the case here.

papr 22 November, 2021, 20:37:19

The issue can only be caused by two things: Either the Pupil clock offset changed or the monotonic lock was not monotonic. I will go sure and replace the custom clock implementation with time.monotonic in our next release.

papr 22 November, 2021, 20:33:10

This is the implementation of the software clock timestamping frames on Windows https://github.com/pupil-labs/pyuvc/blob/master/windows_time.pxi

papr 22 November, 2021, 20:35:07

Maybe we should replace it with https://docs.python.org/3/library/time.html#time.monotonic

user-b14f98 22 November, 2021, 20:37:54

This is in Capture, not HMD-Eyes, correct?

papr 22 November, 2021, 20:38:06

Correct. (although the former can be triggered via the T command)

user-b14f98 22 November, 2021, 20:39:47

Ok. I wish I could test this out for you, but I don't have the source setup on this machine yet.

papr 22 November, 2021, 20:41:28

The issue above is hard to reproduce. I am suspecting a floating rounding issue. That would be hard to reproduce. If you get the issue repeatedly it might not be related to the windows lock after all but to the Pupil clock offset.

user-b14f98 22 November, 2021, 20:40:06

...and it's unlikely I have time to setup before I leave for the thanksgiving holiday.

user-b14f98 22 November, 2021, 20:40:16

(for me, that's tomorrow afternoon)

user-b14f98 22 November, 2021, 20:45:26

if it happens again, we will let you know and will save and share the log

user-b14f98 22 November, 2021, 20:45:40

...but, I may have to shelve this experiment for a while if it does.

user-b14f98 22 November, 2021, 20:45:55

It's thanksgiving break, then two weeks of classes, then winter break.

user-b14f98 22 November, 2021, 20:46:11

So, my window for rounding up potential participants is small.

user-b14f98 22 November, 2021, 21:08:57

papr, how much error woudl you expect this to introduce if we removed the halting message?

user-b14f98 22 November, 2021, 21:09:03

if we allowed recording to continue

user-b14f98 22 November, 2021, 21:10:29

Do you have an intuition if this would cause only a one frame error, once in a while? Would allowingthe non-monotonic time stamp cause the entire pupil system to halt?

papr 22 November, 2021, 21:13:54

If at all, I would skip the frame. Otherwise you need to hallucinate a new timestamp. But if the clock is wrong then it is likely that the next frame might be affected as well. And yes, that could cause that no scene frames would be recorded anymore.

user-b14f98 22 November, 2021, 21:14:43

I am willing to accept a few occasional dropped frames if it allows the recording to continue.

papr 22 November, 2021, 21:15:32

Then I suggest writing a plugin that replaces the recorder plugin. But I am not 100% sure if the current architecture allows that. You might need to start this plugin via the network api which should be ok in your case

user-b14f98 22 November, 2021, 21:16:11

Ehrf. Ok, thanks.

user-b14f98 22 November, 2021, 21:16:30

Any estimate on how long it will be before the next capture update?

papr 22 November, 2021, 21:16:43

I want to publish it this week

user-b14f98 22 November, 2021, 21:16:37

/release?

user-b14f98 22 November, 2021, 21:16:54

Oh, then I'll just wait! Thanks 🙂

papr 22 November, 2021, 21:17:19

You are referring to the clock update, correct?

user-b14f98 22 November, 2021, 21:17:32

Yes

papr 26 November, 2021, 11:39:40

I think I want to give this change more time for testing. I can get you a pre-release including the change, though, if you want.

user-5b0955 24 November, 2021, 05:45:48

I noticed a VR environment, where a user is gazing towards objects. Is that environment or app available in the Oculus VR app store?

papr 26 November, 2021, 11:40:05

Check out https://github.com/pupil-labs/hmd-eyes/ 🙂

user-02e33f 29 November, 2021, 02:04:23

Hello. can i ask Hardware of Pupil VR add-on?

papr 29 November, 2021, 15:04:03

You can find general information about it here https://pupil-labs.com/products/vr-ar/ or you can contact sales@pupil-labs.com if you have specific questions.

user-8779ef 29 November, 2021, 15:13:33

Hey @papr , @user-3cff0d . Gabe here again using my professional account. @user-b14f98 is my other account) I would like to share my understanding of the offline calibration of HMD-Eyes data so that you can correct me where I'm wrong. Here's what I think I know...

  • When calibrating in real-time through HMD-Eyes, Unity is able to send the 3D position of the calibration points to the PL server.
  • However, only the 2D screen coordinates of the calibration points are stored for offline calibration.
  • When re-calibrating an HMD offline, the 2D coordinates are paired with a hardcoded reference depth values and unprojected to recover 3D positions.
  • So, one possibility is that the reference depth is set incorrectly, and this is degrading the track quality (we have some data on this now that @user-3cff0d can share)
  • An alternative approach to offline calibration is to allow reference positions to vary and be estimated in the bundle adjustment process.
End of November archive