Galaxywalk/iLiDAR
Tentang
Open-source iOS app for real-time synchronized iPhone LiDAR depth and RGB streaming to a PC for robotics and computer-vision data capture.
Sains dan teknikPertumbuhan bintang terukur
- dalam 24 jam
- 0
- dalam 7 hari
- Mengumpulkan riwayat
- dalam 15 hari
- Mengumpulkan riwayat
- dalam 1 bulan
- Mengumpulkan riwayat
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
AsliiLiDAR — Real-Time iPhone LiDAR + H.265 RGB-D Streaming
iLiDAR turns an iPhone Pro or iPad Pro into a low-latency, plug-and-play RGB-D sensor for robotics and 3D vision across macOS, Linux, and Windows. It streams hardware-synchronized H.265/HEVC RGB video (640×480 / 960×720 / 1920×1440, zero B-frame latency), bit-exact lossless 320×240 Float16 LiDAR depth maps, presentation timestamps, and pre-scaled camera intrinsics over plug-and-play wired USB (usbmuxd, no iproxy required) or Wi-Fi (Bonjour auto-discovery) directly into the ilidar CLI and Python SDK.
What's New in v2.1
- One-Command
ilidarToolchain (macOS · Linux · Windows): Launch live streaming, a decoupled OpenCV RGB-D viewer (--preview),.npzrecording (--record), USB + LAN discovery, and offline replay from a single CLI or a 5-line Python API. - Hardware VideoToolbox H.265/HEVC Encoding: Real-time zero-B-frame Apple Silicon HEVC compression cuts RGB bandwidth by 3–8× compared to per-frame JPEG, with automatic IDR keyframe injection on every client connection (and automatic JPEG fallback on older Simulators).
- Plug-and-Play Native USB & Zero-Config Wi-Fi:
- Native USB (
usbmuxd, Zeroiproxy): Talks directly to the systemusbmuxdservice (/var/run/usbmuxdon macOS & Linux,127.0.0.1:27015on Windows) — just plug in a Lightning / USB-C cable and runilidar connect --usbfor sub-millisecond jitter, zero Wi-Fi interference, and simultaneous charging. - Dual Network Modes: Listen Mode (default — iPhone listens on
:5678for USB or Bonjour_ilidar._tcpWi-Fi; PC connects without typing IPs) and Connect Mode (PC runsilidar listen; iPhone connects via Bonjour or Saved Servers).
- Native USB (
- Atomic
ILDRv2 Protocol & Lossless Depth Codec: Each RGB-D pair is sent as one atomic packet carrying nanosecondCMSampleBuffertimestamps, pre-scaledK_rgb&K_depth, Annex-B H.265 (or JPEG), and Delta + Byte-Shuffle + LZ4Float16depth (150 KBraw →~55 KB, ~2.7× smaller, 100% bit-exact). Generation-guarded 2-frame backpressure prevents latency buildup on slow links. - Pure Swift, Zero CocoaPods (+ Simulator Mode): Built solely on Apple's native
AVFoundation,VideoToolbox,Metal,Compression, andNetwork.framework. OpeniLiDAR.xcodeprojdirectly—nopod install—and test end-to-end without hardware using the synthetic 30 FPS iOS Simulator stream.
Quick Start
1. Build & Launch the iOS App (Xcode 15+ / iOS 16+)
- Open
iLiDAR.xcodeprojin Xcode on macOS (no CocoaPods required). - Select your Apple Development team under Signing & Capabilities.
- Run on a LiDAR-equipped iPhone Pro / iPad Pro (iPhone 12 Pro or newer)—or on the iOS Simulator for synthetic testing—and allow Camera and Local Network access.
- Keep the app in the foreground; by default it starts in
LISTEN <IP>:5678mode withStream ON.
2. Install the ilidar Toolchain (Python 3.10+)
pip install -e ".[viz]" # Includes prebuilt PyAV (H.265) + OpenCV / Matplotlib (`--preview`)
# Or minimal headless SDK only: pip install -e .
Cross-Platform USB Prerequisites (No
iproxyneeded):
- macOS: Works out of the box (
usbmuxdis built into macOS).- Windows: Install Apple Devices (or iTunes) from the Microsoft Store so Apple Mobile Device Service runs on
127.0.0.1:27015.- Linux: Install
usbmuxd(sudo apt install usbmuxd);udevstarts it automatically when an iPhone is plugged in.
3. Stream from the Command Line
Option A — Plug-and-Play Wired USB (Recommended for 30 FPS / High-Res / Long Captures)
ilidar connect --usb --preview --record ./recordings/run_01
Option B — Wi-Fi Auto-Discovery or Explicit IP
ilidar connect --preview # Auto-discovers USB first, then Wi-Fi (Bonjour)
ilidar connect 192.168.1.42 --preview # Force Wi-Fi connection to an explicit iPhone IP
ilidar discover # List attached USB & LAN Wi-Fi iLiDAR devices
Option C — PC as Server & Offline Replay
# Switch iPhone Config -> Mode to "Connect to PC", then tap your PC under Connection:
ilidar listen --port 5678 --preview --record ./recordings/run_01
# Inspect a recorded session offline:
ilidar replay ./recordings/run_01
4. Stream & Replay in Python
import ilidar
# Checks native USB (usbmuxd) first, then Bonjour Wi-Fi, then localhost Simulator.
# Or explicitly select wired USB: ilidar.LiDARStream.usb() / ilidar.stream(mode="usb")
with ilidar.stream() as s:
for frame in s:
rgb = frame.rgb # (720, 960, 3) uint8 by default (sensor-landscape)
depth = frame.depth # (240, 320) float32 in meters
K_rgb, K_depth = frame.K_rgb, frame.K_depth # (3, 3) float32 intrinsics
pts, colors = frame.to_pointcloud(min_depth=0.2, max_depth=5.0)
portrait = frame.upright() # Optional: 90° CW portrait RGB/depth + rotated K
# Offline replay yields identical RGBDFrame objects:
for frame in ilidar.load_recording("./recordings/run_01"):
pts, colors = frame.to_pointcloud()
Recording Format (
--record): Savessession.json(device,session_id,protocol) plus per-frameframe_%08d.npzfiles (frame_id,timestamp_ns,rgb_jpeguint8[],depth_f16(240, 320) float16meters,K_rgb,K_depth,depth_smoothed), which can also be read directly vianp.load()without installingilidar.
Bandwidth & Preset Guide
Configure RGB Resolution, Frame Rate (1–30 FPS), RGB Video Quality (0.20–0.90), and Depth Smoothing live in the app under Config → Stream Encoding. Live throughput (FPS · MB/s) is shown in the top-left HUD.
| Preset / Scenario | RGB Resolution | Video Quality | H.265 RGB Avg | Frame Size (RGB + Depth) | FPS | Sustained Bandwidth | Recommended Link |
|---|---|---|---|---|---|---|---|
| Low Bandwidth (Weak Wi-Fi / telemetry) | 640×480 |
0.35 |
~4–6 KB | ~60 KB | 10 | ~0.6 MB/s (~5 Mbps) | 2.4 / 5 GHz Wi-Fi |
| Balanced (App Default) | 960×720 |
0.45 |
~9–12 KB | ~65–70 KB | 15 | ~1.0 MB/s (~8 Mbps) | 5 GHz Wi-Fi / USB |
| Smooth Tracking (VIO / real-time SLAM) | 960×720 |
0.45 |
~9–12 KB | ~65–70 KB | 30 | ~2.0 MB/s (~16 Mbps) | 5 GHz Wi-Fi / USB |
| High-Res Mapping (3D reconstruction) | 1920×1440 |
0.50 |
~28–32 KB | ~85 KB | 15 | ~1.3 MB/s (~10 Mbps) | 5 GHz Wi-Fi / USB |
| Full Fidelity (Dense dataset capture) | 1920×1440 |
0.80 |
~40–45 KB | ~95–100 KB | 30 | ~2.9 MB/s (~23 Mbps) | Wired USB (--usb) / 5 GHz Wi-Fi |
- Lossless Depth Floor: Native LiDAR depth is always
320×240Float16(150 KBraw), compressed losslessly via Delta + Byte-Shuffle + LZ4 to ~50–60 KB/frame regardless of RGB resolution. Enabling Smooth (temporal-spatial depth filtering, ON by default) slightly reduces noise and compressed size. - Graceful Backpressure: At most 2 frames are kept in flight on the socket; if network throughput drops below the target rate, excess frames are dropped at capture time rather than queuing multi-second lag.
Wire Protocol (ILDR v2)
All multi-byte header fields are big-endian:
| Section | Size | Layout |
|---|---|---|
| Envelope | 16 B |
magic="ILDR" (4B), version=2 (u8), msg_type (u8: 1=Session JSON, 2=RGBD Frame), flags (u16: bit0=DEPTH_LZ4 [Delta+Shuffle+LZ4], bit1=DEPTH_SMOOTHED, bit2=RGB_HEVC, bit3=RGB_KEYFRAME), header_len (u32), payload_len (u32) |
| RGBD Header | 64 B |
frame_id (u64), timestamp_ns (u64), rgb_w, rgb_h, depth_w, depth_h (4×u16), K_rgb (4×f32: fx, fy, cx, cy), K_depth (4×f32: fx, fy, cx, cy), rgb_size (u32), depth_size (u32) |
| RGBD Payload | Variable | rgb (rgb_size B: Annex-B H.265 access unit when RGB_HEVC is set, else JPEG) + depth (depth_size B: little-endian float16 meters, raw or UInt16-Delta + Byte-Shuffle + raw-LZ4 block) |
Reference & License
- Built upon the Apple Official Depth Camera Example.
- Released under the MIT License.
Jelajahi proyek terkait
Memuat…