🄽 core-xr


user-4dc2c6 10 January, 2023, 10:06:18

I have a few questions about the HTC Vive add-on.

1: What is the delay between pupil movement and its position measurement. Like when the pupil is moving, how much time the add-on needs to detect the position? What's the process time of it?

2: How can we know if a new measurement is available for us to read? In our case, we need to use our own code to read the measurement, to avoid repeat reading the data, we need to check if there is a new data generated.

3: Since our case is time sensitive, we need the real-time. Is there any way we can transform the timestamp to the real-time?

papr 10 January, 2023, 12:07:11

Hi!

1) ~8.5ms camera latency + > 3ms processing time (depends on the enabled plugins) + result transport time (depends on your setup). 2) The API provides a stream of samples. If you are using hmd-eyes, the gaze controller has a corresponding callback https://github.com/pupil-labs/hmd-eyes/blob/master/plugin/Scripts/GazeController.cs#L10 3) If you are using hmd-eyes, you can use this function to transform the Pupil Core timestamps into Unity time https://github.com/pupil-labs/hmd-eyes/blob/master/plugin/Scripts/TimeSync.cs#L35

user-8779ef 11 January, 2023, 04:51:48

This is the code I'm creating. I will understand if your response is, "Create a simplified version." It's clean, but a lot. https://github.com/gabrielDiaz-performlab/RAFT/blob/71d8f40d7ad3bf2bfab4cdb1e1b8a3db5bce215d/flow_source.py#L146

user-4dc2c6 11 January, 2023, 09:41:17

Thank you for the reply, just wondering if there is also sample code for reading the pupil measurement from the add-on?

papr 11 January, 2023, 09:44:11

The repo includes multiple demos that demonstrate the different features of the Unity plugin.

papr 11 January, 2023, 09:57:57

Note the difference between pts (presentation timestamps) and dts (decoding timestamps). In the h264 format, frames are not necessarily decoded in presentation order. When creating new frames, ensure to maintain dts order, too.

user-8779ef 11 January, 2023, 14:31:48

Oh, no. That sounds very icky.

papr 11 January, 2023, 14:32:48

it should be one additional line. Frame.dts=raw_frame.dts

user-8779ef 11 January, 2023, 14:32:14

I was hoping to crawl through the vid in a for loop and build the new vid frame by frame. However, if there's an issue with order, then ... I have to buffer and re-order as I go?

user-8779ef 11 January, 2023, 14:33:00

Oh, that's what you mean!

papr 11 January, 2023, 14:33:08

And maybe setting the packet dts/pts too

user-8779ef 11 January, 2023, 14:33:18

...and don't set pts?

user-8779ef 11 January, 2023, 14:33:27

or, set both?

papr 11 January, 2023, 14:34:43

Both

user-8779ef 11 January, 2023, 14:34:11

reading this tutorial (http://dranger.com/ffmpeg/tutorial05.html) now to try and figure this out myself. I have already read it, but ... apparently missed something

user-8779ef 11 January, 2023, 14:38:20

Ok thanks. I'll give that a shot. I thought this is what led to the eerror that I posed above about non-monotonic stamps, but trust yah

papr 11 January, 2023, 14:44:48

Application provided invalid, non monotonically increasing dts to muxer I assume that the frames or packets dts inherited the pts which were not monotonically increasing due to how h264 had encoded them.

user-8779ef 11 January, 2023, 14:46:16

I think that you may be right.

user-8779ef 11 January, 2023, 14:46:41

"AttributeError: attribute 'dts' of 'av.frame.Frame' objects is not writable"

user-8779ef 11 January, 2023, 14:46:52

Looks like I can't set DTS directly.

papr 11 January, 2023, 14:47:30

Try setting them on the packet instead

user-8779ef 11 January, 2023, 14:47:28

I could set new_frame.pts = old_frame.dts ... ?

user-8779ef 11 January, 2023, 14:47:33

K

user-8779ef 11 January, 2023, 14:48:43

Running it. Let's see if it holds up. Thanks!

user-8779ef 11 January, 2023, 14:54:06

Any other critical settings related to timing? I'm also settings the: * video stream.time_base * video stream.codec_context.time_base * frame_out.time_base * packet.dts * packets.pts

papr 11 January, 2023, 14:54:23

Looks good to me

user-8779ef 11 January, 2023, 14:55:07

Ok, great. I did this last night without setting pts / dts, and although the vid loads into player, scrobbling through doesn't seem to change anything

papr 11 January, 2023, 14:55:47

scrobbling through doesn't seem to change anything Not sure what you mean. Do you see a specific issue?

user-8779ef 11 January, 2023, 14:55:21

I assume it uses dts/pts for that

user-8779ef 11 January, 2023, 14:57:14

Yes. Changing the location on the player timeline at the bottom of the screen is not changing frame loc.

papr 11 January, 2023, 14:58:02

Ah, ok. Have you deleted the *_lookup.npy files before opening the recordings in Player?

user-8779ef 11 January, 2023, 14:57:47

I do not see an error loading world.mp4

user-8779ef 11 January, 2023, 14:58:15

Oh, let me try that. I forgot that you suggested it.

user-8779ef 11 January, 2023, 14:59:15

No luck

user-8779ef 11 January, 2023, 14:59:32

Same behavior. In both cases, overread errors if I scroll too far in.

papr 11 January, 2023, 15:02:48

I suggest building a small dedicated script that extracts the following for a given video file: - frame.pts - frame.time_base - relative time (float(frame.pts * frame.time_base)) - frame.dts - packet.pts - packet.dts

Plot those on y-axis vs frame/packet indices on x-axis. Do this for the original and the newly generated one. The goal is that the latter produces the same values as the former.

user-8779ef 11 January, 2023, 15:04:32

Fair suggestion. I'll get to this soon.

user-4dc2c6 11 January, 2023, 22:43:15

for the delay time of the setup, we directly connect the add-on with the computer, in this case, what's the delay time for it?

papr 12 January, 2023, 05:43:00

Do you mean that you would run Pupil Capture and your client software on the same computer? In that case, the transport delay is minimal, probably below a millisecond.

user-8619fb 17 January, 2023, 21:22:00

I was able to find that the precision of the pupil cams are 0.08 - 0.1 degrees and the accuracy is around 1 degree. Just wondering what are the resolution and sensitivity of the tracker?

nmt 20 January, 2023, 10:12:50

Hey @user-8619fb! Tech specs here: https://pupil-labs.com/products/vr-ar/tech-specs/

user-9eed85 19 January, 2023, 19:05:29

Hi, I need to use passthrough api and want to see only one real object, how can I achieved this? anyone please

user-d5881d 22 January, 2023, 06:16:29

Hi I’m just curious I just found out about this company is there a way to purchase the eye tracking modules

nmt 22 January, 2023, 09:52:29

Hi! Yes, you can purchase our eye tracking modules directly from our website (pupil-labs.com/products). If you need help choosing a product, please feel free to ask further questions here, or contact us at info@pupil-labs.com and we will be happy to help you find the best product for your needs šŸ™‚

user-edef2b 23 January, 2023, 15:38:38

Hi! I was wondering how feasible it would be to disassemble (and possibly reassemble) the HTC Vive VR Add-on. We are looking to use the hardware for a custom purpose, but we're unsure whether it would be better for our application to have the casing or just have the parts, and we would like to be able to have both options available.

papr 23 January, 2023, 15:43:39

Hey, disassembly is very likely to break the add-on. But we could sell you a de-cased version (aka just the parts). Please contact info@pupil-labs.com in this regard.

user-edef2b 23 January, 2023, 16:12:46

Thank you!

user-8779ef 24 January, 2023, 02:34:18

Ok, I have improved things quite a bit.

user-8779ef 24 January, 2023, 02:34:33

I was encoding with H.264, you were encoding with MPEG4

user-8779ef 24 January, 2023, 02:34:46

Apparently the transcoding introduced the timing issues.

user-8779ef 24 January, 2023, 02:38:37

The blue dotted lines are the video output. The pts and dts plotted here are multiplied by the video stream's time_base.

Here's a link to the notebook. https://github.com/PerForm-Lab-RIT/retinal_flow_toolkit/blob/main/sandbox/frame_pts-dts.ipynb

There are still some issues, but it's much better than before.

```

np.array(pts[:5]) * float(time_base) array([0.01499962, 0.02633707, 0.05130083, 0.05398642, 0.08163577])

np.array(pts_out[:5]) * float(time_base) array([0.01399252, 0.02532998, 0.05029374, 0.05297932, 0.08062867])

Time base A 1/65535 Time base B 1/65535 Num frames A 4408 Num frames B 4408 Avg rate A 144439140/2415979 Avg rate B 96292760/1611563 Encoded frames A: 0 Encoded frames B: 0 Start time A: 15000 Start time B: 13993 Duration A: 73731000 Duration B: 73788000

Chat image

user-8779ef 24 January, 2023, 02:53:04

but, oh god, the quality of encoding into mpeg4 is horrible!

user-8779ef 24 January, 2023, 03:41:42

I switched the codec to hevc_nvenc because I could not improve the mpeg4 quality. It's possible there's a flag I'm unaware of.

user-8779ef 24 January, 2023, 03:42:25

The timestamps were very, very close to the original. I erased the world_lookup.npy. ....

Chat image

papr 24 January, 2023, 12:52:41

Also, which Player version are you running here?

papr 24 January, 2023, 09:48:10

Could you share the file with me?

user-8779ef 24 January, 2023, 03:42:33

Errrrr

user-8779ef 24 January, 2023, 03:48:07

FWIW, I loaded in the original movie file and scrobbled to the same frame index. It looks like the new one is only index off.

papr 24 January, 2023, 09:49:12

fyi, stream.frames and stream.average_rate are not 100% reliable in my experience

user-8779ef 24 January, 2023, 12:40:17

Yes, I will DM you a link in a moment. I believe stream.frames and stream.average_rate are overwritten in this case, when setting .pst, no?

user-8779ef 24 January, 2023, 12:42:03

Dm'd. Sorry, it's 9.9 gig!

user-8779ef 24 January, 2023, 12:42:53

I can record a smaller one. I don't think there is anything special about the video file.

papr 24 January, 2023, 12:43:40

Not sure how these values are generated, to be honest. Wasn't aware that one could set them manually. Just wanted to point out, that one might not want to rely any calculations based on them.

user-8779ef 24 January, 2023, 12:44:12

Yeah. TO be honest, it was a desperate move that I did not really expect to help šŸ™‚

user-8779ef 24 January, 2023, 12:44:50

I was surprised to se that the start times of the videos were different. I don't believe that you can set those values directly.

papr 24 January, 2023, 12:47:42

Are you referring to this by "different"?

np.array(pts[:5]) * float(time_base) array([0.01499962, 0.02633707, 0.05130083, 0.05398642, 0.08163577])

np.array(pts_out[:5]) * float(time_base) array([0.01399252, 0.02532998, 0.05029374, 0.05297932, 0.08062867])

user-8779ef 24 January, 2023, 13:29:42

Just the world video, only 2 gig: https://drive.google.com/file/d/1H_MYIlrbX_KNW7hlBCGDdI0_hxJwsL3s/view?usp=share_link

papr 24 January, 2023, 14:03:01

I requested access via the Google Drive interface

user-8779ef 24 January, 2023, 13:30:05

3.2.2

user-8779ef 24 January, 2023, 13:30:29

Oh, I'm outdated!

user-8779ef 24 January, 2023, 13:30:33

Upgrading to 3.5...

user-8779ef 24 January, 2023, 13:30:42

(using a machine I don't usually use for this. Oops!)

papr 24 January, 2023, 13:32:11

This explains the skipped frame warning. Please use a newer version and regenerate the lookup table.

user-8779ef 24 January, 2023, 13:56:06

Unfortunately, that did not resolve the issue.

user-8779ef 24 January, 2023, 13:59:04

FWIW, I'm going to put this on google collab and see if someone on the pyav forum can help. Unforutnately, it's a fairly quiet forum, where questions far outnumber answers.

user-8779ef 24 January, 2023, 14:03:35

apologies. given

papr 24 January, 2023, 14:16:07

When I use this script to convert the video into a Player recording, I do not have any issues. https://gist.github.com/papr/bae0910a162edfd99d8ababaf09c643a Could you maybe also share the world timestamp file and info.player.json?

papr 24 January, 2023, 14:20:38

To be fair, I am running the develop branch. Let me try with the latest release.

user-8779ef 24 January, 2023, 14:18:40

info.player.json world_timestamps.npy

papr 24 January, 2023, 14:23:12

Latest release works well, too.

user-8779ef 24 January, 2023, 14:23:21

Interesting.

papr 24 January, 2023, 14:23:52

Just as sanity check: You did delete the lookup after switching to the new version, correct?

user-8779ef 24 January, 2023, 14:23:58

Yes

user-8779ef 24 January, 2023, 14:24:06

Let me double check

user-8779ef 24 January, 2023, 14:24:11

for a very sane sanity check

papr 24 January, 2023, 14:25:06

And another sanity check: You did upload the re-encoded video, and not the original, correct?

user-8779ef 24 January, 2023, 14:25:34

Oh, no. I did upload the original, because I thought that was what you were asking for.

papr 24 January, 2023, 14:26:14

Ah, ok, then no wonder playback is smooth šŸ˜„

user-8779ef 24 January, 2023, 14:25:36

Good question.

user-8779ef 24 January, 2023, 14:25:44

I will upload the re-encoded vid now. šŸ™‚

papr 24 January, 2023, 14:26:54

Apologies for the misunderstanding. Could have been more explicit

user-8779ef 24 January, 2023, 14:26:55

I can't remember what codec I used for encoding this version. I've been trying a few, because it seems to affect timing.

papr 24 January, 2023, 14:27:28

We can check the file's metadata

user-8779ef 24 January, 2023, 14:27:22

https://drive.google.com/file/d/16bgITvrBGbVh4u1kS45AeUKzSYhAGfVj/view?usp=share_link

papr 24 January, 2023, 14:27:52

need access again šŸ™‚

papr 24 January, 2023, 14:34:42

can reproduce the issue with this file (latest release + develop)

user-8779ef 24 January, 2023, 14:27:34

Yep. Named "new_world.mp4"

user-8779ef 24 January, 2023, 14:28:14

done

user-8779ef 24 January, 2023, 14:32:28

Huh. I just ran without setting any pts / dts, and now I get the *exact * same pts dts in my new video

papr 24 January, 2023, 14:34:09

nice, that sounds like the way to go

user-8779ef 24 January, 2023, 14:32:33

same as the old

user-8779ef 24 January, 2023, 14:32:46

I'll carry this test through - gimme a few.

user-8779ef 24 January, 2023, 14:34:06

I should say, this is where I started.

papr 24 January, 2023, 14:34:31

there is probably a teeny tiny difference somewhere

user-8779ef 24 January, 2023, 14:45:36

Success!

user-8779ef 24 January, 2023, 14:46:20

Funny - there is an interaction with the codec. I get errors when using hevc_nvenc

papr 24 January, 2023, 14:50:06

you mean the advance iterator error?

user-8779ef 24 January, 2023, 14:51:01

Sorry, this is on encoding.

user-8779ef 24 January, 2023, 14:51:05

Transcoding.

user-8779ef 24 January, 2023, 14:51:32

when I add the video stream to my container object, I set a codec

user-8779ef 24 January, 2023, 14:51:43
 stream = container_out.add_stream("h264_nvenc", framerate = average_fps)
user-8779ef 24 January, 2023, 14:52:09

This approach (not setting pts / dts) works when using "libx264" but not "h264_nvenc"

user-8779ef 24 January, 2023, 14:54:44

video encoding is zany, man.

user-8779ef 24 January, 2023, 14:54:53

Just check the options on this thing: https://superuser.com/questions/1296374/best-settings-for-ffmpeg-with-nvenc

user-8779ef 24 January, 2023, 14:55:56

Well, perfect is the enemy of the good, and all that. I'll stick with libx264

user-8779ef 24 January, 2023, 14:56:15

Thanks for working with me, here!

papr 24 January, 2023, 14:58:22

Happy to help! Although, you did 99% of the work here šŸ˜‰

user-8779ef 24 January, 2023, 14:58:51

Isn't that how it should be? You were helpful in pointing me to the issues.

user-8779ef 24 January, 2023, 14:59:11

I learned quite a bit about video encoding that will actually be helpful as faculty in an imaging department!

papr 24 January, 2023, 15:03:11

That's the way to go šŸ™‚

user-8779ef 24 January, 2023, 15:05:06

Feel free to share this code and github repo as a ref if anyone else wants to transcode the world vid while doing opencv stuff to the outgoing frames

user-8779ef 24 January, 2023, 15:05:38

I still need to carry over what we've learned from the notebook to the main repo file (flow_source.py), but I should do that later today.

user-29faf0 24 January, 2023, 17:34:28

I'm working with the VR/AR add-on and trying to understand the data from pupil_positions.csv. Does the model_confidence refer to the confidence score of the entire 3D pupil detection data?

Meaning, does a model_confidence of 0.0 indicate that the entirety of the 3D pupil detection data should be disregarded?

Chat image

papr 24 January, 2023, 17:38:03

That is correct šŸ™‚

user-29faf0 24 January, 2023, 17:40:57

In the tests that I conducted, I see that the confidence of 2D detection is 1 for a large sample of data but the model_confidence is 0.1 on the same data sample. Why does that happen / how can I improve the 3D detection?

papr 24 January, 2023, 17:52:16

That means that the 3d is probably not fit well. Check out our documentation for best practices in this regard

user-29faf0 24 January, 2023, 17:58:03

I see, thank you!

user-6cdb90 24 January, 2023, 22:10:54

Hi everyone! I recorded eye movements in a virtual scene and then exported the fixation information from Pupil Player. As I attached images of the scene, there is a green wall, and I am looking for fixations on the green wall, and I need to remove other fixations from the analysis. So, I am wondering if there is a way to define the area of interest, in this case, green wall, and export fixation information associated with this area from Pupil Player, and post analysis since I did not define a surface during the recording.

Chat image Chat image

papr 25 January, 2023, 08:34:18

Hi! Unfortunately, there is no built-in plugin that could do that for you. One would need to process the scene video and use computer vision to extract the area of the green wall in the context of a self-written script.

user-4bc389 28 January, 2023, 05:52:55

Hi Use unity3D. Is there a suitable version recommended? Thank you

papr 30 January, 2023, 11:21:58

Please see https://github.com/pupil-labs/hmd-eyes#develop-integrate-and-extend

user-8779ef 31 January, 2023, 20:09:17

What does it mean when ... "[WARNING] video_capture.file_backend: Advancing frame iterator went past the target frame!" ?

papr 31 January, 2023, 20:09:46

this happens if frame pts != packet pts

user-8779ef 31 January, 2023, 20:09:28

Is this clearly an issue with the number of frames in the video?

papr 31 January, 2023, 20:13:21

Lookup tables use packet pts because one can read them out significantly faster than frame pts (which requires decoding the whole frame)

user-8779ef 31 January, 2023, 20:13:32

This makes sense.

user-29faf0 31 January, 2023, 23:23:30

What is the wavelength of the IR LEDs?

user-d407c1 01 February, 2023, 09:49:34

Hi @user-29faf0 , that would be 850nm Ī» ± 42nm Δλ!

End of January archive