跳转到内容

二维码、LED 与闪光同步

当前的多相机头戴设备用一个电信号触发自己的各台相机(见硬件同步和当前的采集设备)。视觉同步用于连线够不到的一切场合。近期公开的例子:EgoKit 用一台头显或手机加两台 USB 腕戴相机录制,它们之间没有共用的触发线,作者的变通办法是 “to let the three cameras simultaneously capture a millisecond-level timer displayed on a webpage”(意为:让三台相机同时拍摄网页上显示的毫秒级计时器)(Yu 等,2026)。Universal Manipulation Interface(UMI)用二维码同步两个手持夹爪上的 GoPro(Chi 等,2024)。RocSync 用一个 LED 时钟在手术室里同步了超过 25 台相机,包括头戴的 Aria 眼镜、GoPro、iPhone 和一台红外跟踪器(Meyer 等,2025)。

各种情况下的思路都一样。给每台相机看一个时间已知的东西,找出每台相机看到它的那些帧,就得到了每台相机的时钟偏移;做两次,还能得到它的漂移。这些方法的概述,连同二维码误差来源的表格,在软件同步与视觉同步页面;所有方法的精度并排比较在同步方法对比页面。本页深入讲每种视觉方法的工作原理,以及它已发表的测试实际测量了什么。

方法 如何编码时间 已发表的结果 能显示曝光时长吗? 所有相机必须同时看到吗?
由相机读取的二维码 相机固件读取二维码并设置自己的时钟 GoPro 自己给出的数字 “<50 ms”,由 RocSync 引用;UMI 称 ±1/60 s 否 否
从录像中解码的二维码或计时器 相机拍摄显示时间的屏幕;事后对各帧解码 视情况而定;见精度限制 否 否
开灯和关灯 场景亮度的突然变化 在 RocSync 理想的单灯测试中,30 fps 下双目误差为 3.09 px 否 是
随机闪烁的 LED(ROOLS) 一个 LED 按随机的亮/灭序列闪烁 “up to subframe interval precision”(意为:可达亚帧间隔的精度)(Zhao 和 Chen,2009) 否 是,在它闪烁期间
闪烁编码的红外标记 每个 LED 闪烁出一个 ID 和一个共用的时间码 用于在时间和空间上标定摄像机(camcorder)(Yamazoe 等,2004) 否 否
LED 时钟(RocSync) 由 100 个 LED 组成的环,每毫秒前进一步,外加一个二进制计数器 相对于硬件同步为 “1.34 ms RMSE”(意为:均方根误差 1.34 ms)(Meyer 等,2025) 是 否
卷帘快门 LED 灯带 LED 灯带依次切换;亮度发生变化的那一行给出亚帧级时间 对他们的装置为 “approximately 15 µs”(意为:约 15 µs)(Nazarenus 等,2025) 是,前提是传感器特性已标定清楚 是,对参与的那些相机而言

本表和下文中的双目误差都来自 RocSync 的同一个实验,见 GoPro 测试。它们是以像素计的重投影误差,不是时间,只用于在该测试内部比较各方法。

有两种不同的工作流程,它们失败的方式也不同。

GoPro Labs 固件让相机可以从二维码读取设置和命令。其中一种用来设置时钟:“Once you’ve scanned this code with your GoPro, it will have the time and date locked in - accurate to the nearest second”(意为:用你的 GoPro 扫描这个码之后,时间和日期就被锁定,精确到秒)(GoPro Labs 入门介绍)。对于多相机拍摄,GoPro 在它的精确日期和时间页面上提供了一个动画版本。

Tentacle Sync 的 Timebar 应用显示一个时间码二维码,相机读取它,从而 “synchronizes its internal timecode generator to the displayed time”(意为:把它内部的时间码发生器同步到所显示的时间);时间码随后作为元数据存入视频文件。HERO 12 和 13 用原厂固件就能做到(“GoPro HERO 12 and 13 supports this QR code timecode out of the box”,意为:GoPro HERO 12 和 13 开箱即支持这种二维码时间码),不过用二维码设置帧率仍然需要 Labs 固件;HERO 7 至 11 需要 Labs 固件,Tentacle 把那篇文章标为 “experimental”(意为:实验性)。Tentacle 还补偿了相机的反应时间:“GoPros have a latency between “seeing” the QR-code and writing it to the internal clock. We can compensate this gap by sending an offset along with the TC”(意为:GoPro 从“看到”二维码到把它写入内部时钟之间有延迟。我们可以随时间码一起发送一个偏移量来补偿这个差距)(Tentacle:HERO 7–11,Tentacle:HERO 12/13)。

UMI 在它的双夹爪配置中使用这种流程。作者写道,GoPro Labs 固件 “recognizes the global timestamp encoded in the QR code and calibrates its internal clock with ±1/60 second accuracy”(意为:识别二维码中编码的全局时间戳,并以 ±1/60 秒的精度校准其内部时钟)(Chi 等,2024)。

这样得到的是一个只设置了一次的时钟。由此有三个限制:

  1. 设置是粗略的。RocSync 引用 GoPro 的文档,称其给出了 “a synchronization accuracy of <50 ms when using their dynamic QR codes”(意为:使用其动态二维码时同步精度 <50 ms)。
  2. 时钟随后会漂移。RocSync:“GoPro [17] reports that their cameras develop a noticeable time offset as a result of drift 60–90 minutes after synchronization.”(意为:GoPro [17] 报告说,同步之后 60–90 分钟,他们的相机会因漂移而出现明显的时间偏移。)Tentacle:“Keep in mind that time drifting over the day depends on GoPros internal clock (unless you re-sync your GoPro). So for long running shoots it’s always better to attach a SYNC E directly to the GoPro.”(意为:请记住,一天之中的时间漂移取决于 GoPro 的内部时钟(除非你重新同步你的 GoPro)。所以对长时间的拍摄,把一个 SYNC E 直接接到 GoPro 上总是更好。)
  3. 快门没有对齐。时间码是按帧给出的,所以 “residual misalignment of up to half a frame can remain even when pairing the closest timecodes between two video streams”(意为:即使把两路视频流中最接近的时间码配对,仍可能残留最多半帧的错位)(Meyer 等,2025)。

在户外,带 GPS 的 GoPro 相机可以改用卫星时间来设置时钟;见 GPS 时间码。

任何相机都能拍屏幕,包括读不了二维码的网络摄像头、手机和头显。在每次录制的开始和结束各拍一段显示时间的屏幕,对时间可读的每一帧解码,再对这些读数拟合一条直线;比较页面上有一条用来写解码器的提示词。EgoKit 的毫秒级网页计时器是同一做法的纯文本版本。

同样的技巧可以测量相机处理链路的延迟,而不是它的时钟。UMI 拍摄 “a rolling QR code on the computer monitor that displays the current system timestamp for each video frame”(意为:电脑显示器上的滚动二维码,它为每个视频帧显示当前的系统时间戳),从每帧到达计算机的时间 t_recv 中减去解码出的时间 t_display 和已知的显示延迟 l_display,得到相机系统的端到端延迟:l_camera = t_recv − t_display − l_display(Chi 等,2024)。UMI 在同一台显示器上的实时预览画面里把二维码遮掉,“To prevent multiple detections of QR codes”(意为:以防止二维码被多次检测到)。

屏幕的刷新率、显示延迟、跨越一次变化的曝光以及卷帘快门都限制着这种方法。它们列在精度限制表中。因为对拍摄同一块屏幕的每台相机而言显示延迟是相同的,所以在相机与相机之间比较时它会抵消,但在相机与计算机时钟之间比较时不会;这就是 UMI 单独标定 l_display 的原因。

一盏灯打开时,光同时到达房间里的每一台相机。Pupil Labs 用这种方式检查两副眼动追踪眼镜的同步:眼镜被放在 “in front of a light source, the eye cameras facing towards the light”(意为:一个光源前面,眼部相机朝向光源),灯被 “on and off four times”(意为:开关四次)(Pupil Labs LSL relay 指南)。他们的脚本把每帧的像素值求和,所以每次开关都表现为一个阶跃。

RocSync 测试了一个改进版本:“cross-correlating the gradient of average global illumination between the two cameras”(意为:对两台相机的全局平均亮度的梯度做互相关)。它在 30 fps 下给出 3.09 px 的双目误差,在 60 fps 下为 1.11 px,接近不做插值的 LED 时钟。作者强调这是最好的情况:“this experiment represents an ideal scenario for light-based synchronization, with a single ceiling-mounted lamp that turns on and off nearly instantaneously.”(意为:这个实验代表了基于灯光的同步的理想场景,只有一盏吸顶灯,它的开和关几乎是瞬时的。)在真实的房间里,“many lights do not switch on instantaneously, and in large environments such as operating rooms, the ceiling illumination often consists of multiple physical light sources that do not activate at exactly the same time”(意为:许多灯并不是瞬间点亮的,而在手术室这样的大型环境中,顶部照明往往由多个物理光源组成,它们并不在完全相同的时刻点亮)(Meyer 等,2025)。

拍手把一个视觉事件和一个声音结合在一起,但声音很慢:用 RocSync 的话说,“even a 5-meter difference introduces a 15 ms discrepancy in time of arrival”(意为:即使只有 5 米的距离差,也会带来 15 ms 的到达时间差异)。软件同步页面讲了音频。

一盏按很长的、不重复的图案闪烁的灯能给出许多个同步点,而不是一个。

  • 随机开关光源(ROOLS)。Zhao 和 Chen (2009) 用一个随机二值信号驱动一个 LED:“The captured binary-valued sequences are then matched and the temporal offset of the cameras is computed up to subframe interval precision.”(意为:然后对拍到的二值序列进行匹配,并以亚帧间隔的精度算出各相机的时间偏移。)他们称它 “suited for synchronization in both laboratory and outdoor environments”(意为:既适合实验室环境也适合户外环境中的同步)。
  • 闪烁编码的标记。Yamazoe 等 (2004) 在场景中放置了许多红外 LED 标记。每个标记闪烁出自己的 ID 和一个共用的时间码,状态变化的频率为 “29.97 Hz to match the video signals”(意为:29.97 Hz,以匹配视频信号),采用持续一秒的 30 位编码(20 位 ID,10 位时间码)。因为每个标记闪烁的是同一个时间码,所以看到不同标记的相机仍然共享时间。

一个闪烁的 LED 需要许多帧才能说出现在是什么时间,而且无法显示快门打开了多久。RocSync 的 LED 时钟在单独一帧里就能显示这两者(Meyer 等,2025)。

这个时钟是一块 25 × 25 cm 的电路板,上面有:

  • 由 100 个 LED 组成的环,红光和红外,每次点亮一个,每毫秒前进一步:“The step duration of 1 ms was chosen to provide millisecond-level accuracy, while the use of 100 LEDs ensures correct operation for exposure times of up to 100 ms”(意为:选择 1 ms 的步长是为了提供毫秒级精度,而使用 100 个 LED 则保证在曝光时间不超过 100 ms 时能正确工作),“supporting frame rates from 10 to 1000 fps”(意为:支持 10 到 1000 fps 的帧率)。
  • 一个 16 位的二进制计数器,它 “increments with each full rotation of the ring”(意为:环每转满一圈就加一),所以它以 100 ms 为步长计数。这给出 “unique timestamps with millisecond precision for up to 109 minutes”(意为:在长达 109 分钟内不重复的、毫秒精度的时间戳)(2^16 × 0.1 s = 6553.6 s,约 109 分钟)。
  • 位于中央的 ArUco 标记,一种容易检测的方形基准图案,外加四个角点 LED,用来细化电路板在图像中的位置。“One corner includes an additional IR LED to resolve rotation ambiguity in infrared videos where the ArUco marker is not visible.”(意为:其中一个角上多了一个红外 LED,用来在看不到 ArUco 标记的红外视频中消除旋转歧义。)
  • 一个 32 位 RISC-V 微控制器,“with an external temperature-compensated crystal oscillator (TCXO) for precise timekeeping”(意为:带有外部温度补偿晶体振荡器(TCXO),用于精确计时),由电池供电。

电路板包了一层哑光黑膜以减少反光,并且 “an estimated cost of approximately US$20 per unit”(意为:每块的估计成本约为 20 美元)。

“Because camera shutters are not instantaneous, light is integrated over the exposure period (typically a few milliseconds), causing several adjacent LEDs to appear illuminated in a single frame. The first and last LED in this arc correspond to the start and end of the exposure window, respectively”(意为:因为相机快门不是瞬时的,光在曝光期间(通常为几毫秒)被累积,导致单独一帧里有几个相邻的 LED 看起来都是亮的。这段弧上的第一个和最后一个 LED 分别对应曝光窗口的开始和结束)。

举例说明这里的算术(这是我们自己的例子,不是论文里的):如果计数器读数为 12,亮起的弧从 LED 40 延伸到 LED 57,那么曝光在时钟的 12 × 100 + 40 = 1240 ms 处开始,在约 1257 ms 处结束,所以持续了约 17 ms。

Reading an exposure window from an LED clock A drawing of an LED clock board of the RocSync kind: a ring of 100 LEDs, one lit at a time and advancing every millisecond, a 16-position binary counter that increments once per full turn of the ring, so it counts 100-millisecond steps, and a central fiducial marker. During one camera exposure several neighbouring LEDs light up, forming an arc. In the page's worked example the counter reads 12 and the arc runs from LED 40 to LED 57, so the exposure started at 12 times 100 plus 40, 1240 milliseconds on the clock, and ended at about 1257 milliseconds, lasting about 17 milliseconds. The first lit LED marks the exposure start, the last the end. LED 0 counter = 12 first lit LED (40): exposure start last lit LED (57): exposure end The board ring of 100 LEDs, one lit at a time, advancing every 1 ms 16-bit counter: +1 per full turn (100 ms) centre marker locates the board Worked example start = 12 × 100 + 40 = 1240 ms end ≈ 12 × 100 + 57 = 1257 ms exposure ≈ 17 ms Drawing not to scale
How an LED clock of the RocSync kind records an exposure window. One LED of a 100-LED ring is lit at a time, advancing every millisecond, and a binary counter counts full turns; during an exposure several neighbouring LEDs light up, so the first and last lit LEDs give its start and end. The numbers are this page's worked example (counter 12, LEDs 40 to 57). Drawing not to scale.

RocSync 把每台相机的时钟拟合到曝光开始时刻,而不是曝光中点:“We assume that the start of the exposure is always aligned with the regular frame interval, while automatic exposure control only affects the end.”(意为:我们假定曝光的开始总是与规则的帧间隔对齐,而自动曝光控制只影响曝光的结束。)

操作员在一次录制的开始和结束,把时钟依次展示给每台相机,各几秒钟;相机从来不需要同时看到它。之后流程执行六个步骤:找到 ArUco 标记,根据它的四角对电路板做粗略校正,定位角点 LED,根据它们细化校正,解码环和计数器,拟合时间戳。它在三个环节剔除帧:

  • “a frame is rejected if the detected ArUco marker occupies less than 0.2% of the image area”(意为:如果检测到的 ArUco 标记占图像面积不到 0.2%,该帧被剔除),因为这时 LED 太小,无法区分;
  • 如果角点 LED “deviate from their expected positions by more than a specified threshold”(意为:偏离其预期位置超过规定的阈值),该帧被剔除;
  • “a frame is rejected if the ring does not display a single illuminated sector or if the sector crosses the counter boundary, as this indicates the counter changed during the exposure”(意为:如果环上显示的不是单独一段亮起的扇区,或者该扇区跨越了计数器边界,该帧被剔除,因为这表明计数器在曝光期间发生了变化)。

最后,“robust RANSAC regression”(意为:鲁棒的 RANSAC 回归)把所有已解码帧的时间戳结合起来,“by fitting a linear function and computing the global offset and drift of the video”(意为:方法是拟合一个线性函数,并计算该视频的全局偏移和漂移)。对每台相机,模型为 T = α · t + β,其中 t 是相机自己的帧时间,T 是时钟时间,β 是偏移,α 是速率。只有一个同步点时,RocSync 令 α = 1,“which assumes that the camera’s local clock has no drift”(意为:这假定相机的本地时钟没有漂移)。

RocSync 的真值是两台用同步线连接的 Azure Kinect DK 相机,“facing opposite directions”(意为:朝向相反的方向),分辨率 1920 × 1080,帧率 30 fps,“with a fixed exposure time of 8.33 ms”(意为:固定曝光时间为 8.33 ms)。时钟先向一台相机展示约 5 秒,2 分钟后再向另一台展示,距离约 150 cm;5 分钟后重复这一循环,得到 “five independent 14-minute recordings”(意为:五段独立的 14 分钟录制)。两台相机恢复出的时间戳之间的 RMSE(均方根误差)为 0.38、1.30、1.94、1.73 和 1.37 ms,平均 1.34 ms,而帧周期为 33.3 ms。

作者 “attribute the residual error primarily to the rolling shutter of the Kinect’s RGB sensor”(意为:把残余误差主要归因于 Kinect 的 RGB 传感器的卷帘快门):环上的 LED 位于不同的图像行,所以解码出的时间略微取决于时钟在画面中的位置以及哪些 LED 亮着。“To reduce this artifact, the clock can be held at a greater distance from the camera”(意为:为了减小这种伪影,可以把时钟拿到离相机更远的地方)。

RocSync 的 GoPro 测试:二维码、灯光、音频和 LED 的比较

Section titled “RocSync 的 GoPro 测试:二维码、灯光、音频和 LED 的比较”

两台 GoPro(一台 Hero 12 和一台 Hero 10)相距约 1 m,以 60 fps 和固定的 1/480 s 曝光录制,它们的时钟在录制即将开始前用 GoPro Labs 二维码设置。一块棋盘格在两台相机前快速移动。因为没有对齐的一对相机标定结果会很差,所以双目重投影误差可以衡量同步的好坏。五次运行的平均值,30 fps / 60 fps:

方法 误差(px)
LED 时钟,带插值 1.02 / 0.95
LED 时钟,最近帧 3.07 / 1.11
开灯和关灯 3.09 / 1.11
音频(拍手) 11.34 / 13.91
音频,带插值 12.90 / 14.64
二维码时间码 54.60 / 55.14

二维码时间码的结果很大,是因为时钟只用二维码设置了一次,之后每台相机各自运行。带插值时,LED 时钟 “achieves nearly the same error at 30 fps as at 60 fps”(意为:在 30 fps 下达到与 60 fps 下几乎相同的误差)。

在 “using more than 25 cameras”(意为:使用超过 25 台相机)的手术录制中,“Out of 73 total recordings, only one instance failed synchronization. This was associated with the Aria glasses worn by the lead surgeon. The failure was not due to our method, but rather to frame drops in the recordings from the Aria glasses.”(意为:在总共 73 段录制中,只有一例同步失败。这一例与主刀医生佩戴的 Aria 眼镜有关。失败的原因不在我们的方法,而在 Aria 眼镜的录制中出现了丢帧。)在两个同步点之间拟合直线,假定中间没有丢帧;见丢帧。

卷帘快门一行接一行地读出(见卷帘快门的行时序),所以灯光发生变化的那一行能告诉你它是在帧内的什么时刻变化的。Gaussians on Fire 用这一点同步三台 GoPro Hero 13 Black 相机,它们以 400 Hz、1280 × 720 拍摄火焰。

他们的电路板是一个驱动 21 个引脚的 ESP32 微控制器。其中十六个驱动帧计数器:“The frame counter is displayed using 15 white LEDs, which represent the frame number in Gray code. An additional LED is employed to resolve the inherent ambiguity of the Gray code, preventing frame errors that could otherwise reach up to one frame.”(意为:帧计数器用 15 个白色 LED 显示,它们以格雷码表示帧号。另外用了一个 LED 来消除格雷码固有的歧义,防止本来可能达到一帧的帧误差。)格雷码(Gray code)是一种二进制计数方式,相邻的数只有一位不同,所以曝光中途发生的变化不会产生错得离谱的读数。另外五个驱动 LED 灯带:“we exploit the pronounced rolling shutter effect present in most CMOS consumer cameras by sequentially toggling a series of five COB LED strips.”(意为:我们依次切换一组共五条 COB LED 灯带,以利用大多数 CMOS 消费级相机中明显的卷帘快门效应。)

他们的精度是估计值,不是测量值:行时间(约 3 µs)乘以亮度边缘的定位精度(约 5 px),得到 “a temporal precision of approximately 15 µs”(意为:约 15 µs 的时间精度)。他们在自己的装置上观察到行读出时间为 2.85 µs。15 µs 约为 400 Hz 下 2.5 ms 帧间隔的 1/170。

这种方法需要一个特性已标定清楚的传感器(“For a fully characterized sensor, detecting the image points where the LED strip brightness changes allows us to directly determine the exposure time”,意为:对于特性已完全标定清楚的传感器,检测 LED 灯带亮度发生变化的图像点,就能让我们直接确定曝光时间),而且灯带必须在每台相机的视野内。

精确知道每一帧的时间,本身并不能让各帧对齐。两台自由运行的 30 fps 相机的曝光仍然可能相差最多半帧(33.3 / 2 = 16.7 ms)。一旦每一帧都有了亚帧级的时间戳,就可以插值到一个共同的瞬间。

对检测结果插值。在每台相机位于目标时间两侧的帧中检测二维点,例如棋盘格角点或手部关节,把它们的图像坐标插值到目标时间,然后再做三角化。RocSync 用四台 GoPro Hero 12 相机做了测试,30 fps,快门 1/240 s,场景是模拟的手术,带有人工标注的二维手部姿态。在手部快速运动的六个时刻上,平均三角化误差为 “4.4 px when using interpolation, compared to 8.8 px when using the nearest-frame synchronization strategy”(意为:使用插值时为 4.4 px,而使用最近帧同步策略时为 8.8 px)(不做插值时,单个时刻的值最高达到 20.85 px)。用两对相机分别对同一个时刻做三角化,“sub-frame synchronization reduced the mean Euclidean distance between poses from 26.07 mm without interpolation to 7.52 mm with interpolation”(意为:亚帧同步把位姿之间的平均欧氏距离从不插值时的 26.07 mm 降到了插值时的 7.52 mm)(Meyer 等,2025)。

Interpolating keypoints to a common instant Top: two free-running 30 fps cameras, frames 33.3 ms apart. Camera A exposes at 0, 33.3, 66.7 and 100 ms; camera B, with an assumed offset of 12 ms, at 12, 45.3, 78.7 and 112 ms. To triangulate at camera A's frame at 66.7 ms, the nearest camera B frame is 12 ms late. Bottom left: instead, a keypoint detected in camera B's frames at 45.3 ms and 78.7 ms is interpolated to 66.7 ms, at fraction (66.7 - 45.3) / 33.3, about 0.64, of the way between the two detections. Bottom right: RocSync's results with four GoPro Hero 12 cameras at 30 fps (Meyer et al., 2025): mean triangulation error over six moments of fast hand motion fell from 8.8 px with the nearest frame to 4.4 px with interpolation, and the distance between two pairs' poses of one moment from 26.07 mm to 7.52 mm. camera A camera B 0 33.3 66.7 100 ms 12 45.3 78.7 112 t* = 66.7 nearest B frame: 12 ms late Both cameras 30 fps; camera B’s 12 ms offset is assumed for the example. Interpolate the detection to t* keypoint in B at 45.3 ms B at 78.7 ms p* at t*, 0.64 of the way RocSync, 4 GoPros at 30 fps mean triangulation error, fast hand motion 8.8 px nearest frame 4.4 px interpolated distance between two pairs’ poses 26.07 mm nearest frame 7.52 mm interpolated
Two free-running 30 fps cameras are up to half a frame apart. Rather than pairing each frame with the other camera's nearest frame, interpolate the other camera's detections to the same instant before triangulating; this needs a sub-frame timestamp for every frame. The 12 ms offset is assumed for the example. The bars are RocSync's measured results with four GoPro Hero 12 cameras at 30 fps (Meyer et al., 2025).

对图像插值。当某种方法需要完整的图像时,可以用视频帧插值模型合成每台相机在共同瞬间的视图。RocSync 应用 Jin 等人的方法生成时间上对齐的帧,并用 MASt3R 重建场景:“the interpolated frames produce noticeably higher-quality reconstructions with fewer”(意为:插值得到的帧产生的重建质量明显更高,且有更少的)伪影,而一把最近帧重建漏掉的快速运动的锤子 “mostly reconstructed using sub-frame interpolation”(意为:使用亚帧插值后大部分被重建出来)。

这些提示词要的是你自己能检查的代码;先读输出,再决定是否相信它。

写一个使用 OpenCV 的 Python 脚本,解码一段视频最前 20 秒和最后 20 秒中的 LED
同步时钟。电路板上有一个位于中央的 ArUco 标记(字典和 ID 作为参数给出)、四个
位于已知板上坐标的角点 LED、一个以 100 ms 为步长计数的 16 个 LED 的二进制计数器,
以及一个由 100 个 LED 组成的环,每毫秒点亮一个。对每一帧:检测标记;如果它占
图像面积不到 0.2%,剔除该帧;先根据标记、再根据角点 LED 用单应性(homography)
校正电路板;对每个 LED 做阈值判断;如果环上显示不止一段亮起的弧,或者弧跨越了
从 99 回到 0 的回绕处,剔除该帧。把第一个亮起的 LED 和计数器换算成以 ms 计的
时钟时间。用 PyAV 从容器中读取每一帧的显示时间戳(presentation timestamp)
(不要用帧序号乘以标称周期)。用 RANSAC 拟合 clock_time = alpha * pts + beta,
并报告偏移、以 ppm 计的漂移、残差,以及开头和结尾各用了多少帧。

把手部关键点插值到共同的时间

Section titled “把手部关键点插值到共同的时间”
我有来自多台相机的每帧二维手部关键点(每只手 21 个),每一帧都带有已经映射到
共同时钟的时间戳,另外还有标定好的投影矩阵。写一个 Python 函数,对一组目标时间,
在每台相机包夹目标时间的两帧之间对关键点做线性插值(如果其中任一帧缺少检测结果,
或者两帧的间隔超过 1.5 个帧周期,就跳过这台相机),然后用剩下的相机以 DLT 对每个
关节做三角化,并报告每个关节的重投影误差。与使用每台相机最近帧的做法进行比较。

用屏幕测量相机处理链路的延迟

Section titled “用屏幕测量相机处理链路的延迟”
写两个 Python 脚本。第一个显示一个全屏窗口,在每次显示刷新时用当前的
time.monotonic_ns() 重新绘制一个二维码,并记录每次绘制的时间。第二个读取一台
对准该屏幕的实时相机,在同一个时钟上记录每一帧的到达时间,解码二维码,跳过
解码失败的帧,并报告“到达时间减去显示时间”的分布。说明这个结果包含了显示器
自身的延迟,必须像 UMI 论文那样单独测量并减去。