AR Data Format & API
AR Coordinate System

Coordinate Frame:
X-axis: Right
Y-axis: Up
Z-axis: Forward
Pose : [tx,ty,tz,qx,qy,qz,qw]
Translation (first 3 values): Position in meters
tx,ty,tz: X, Y, Z coordinates
Rotation (last 4 values): Orientation as quaternion
qx,qy,qz: Imaginary part
qw: Real part
Difference between local_pose and global_pose:
local_pose: Position relative to device starting pointglobal_pose: Position in shared world coordinate (when multiple devices collaborate)
Note: When using a single device, local_pose and global_pose are identical
Velocity
Format: [vx,vy,vz]
Calculated as: v=ΔtΔp
Unit: meters per second (m/s)
In the same coordinate frame as pose
Camera Intrinsics
Format: [fx,0,0,0,fy,0,cx,cy,1]
Represents 3×3 matrix:
Where:
fx,fy: Focal length in pixels
cx,cy: Principal point (optical center) in pixels
Attention
Camera intrinsics scaling required
The camera intrinsics are originally computed for the original image size 1920 × 1440.
In the current app, the streamed color image size is 640 × 480.
If you use the intrinsics with the streamed images, you must scale the intrinsics to match the new resolution.
(You can follow the method below for implementation.)
Depth Image
Format: 16-bit unsigned integer (uint16)
Unit: 10−4 m (0.1 mm, scaled by 10000 from meters)
Conversion to meters: dmeters=10000draw
Range: 0≤draw≤65535 → 0 to 6.5535 m
Access: Use
data.depthordata.depth_arrayto get numpy array
Image Data Format
Color Image: Two formats available
color_bytes: JPEG compressed bytescolor_array: RGB numpy array (640×480×3)color: Shortcut forcolor_array
Depth Image: Numpy array only
depth_array: uint16 numpy array (256×192)depth: Shortcut fordepth_array
API Reference
ARDataSubscriber
Constructor:
Parameters:
ip(str): iPhone's IP addressport(int): Port number (default: 8000)hwm(int): High water mark (default: 1, keeps only latest message)conflate(bool): Message conflation (default: True)verbose(bool): Print connection info (default: False)
Usage:
Main Methods:
Method
Returns
Description
get()
ARFrame or None
Get latest data frame
get_timestamp()
float or None
Get timestamp only
get_velocity()
np.ndarray or None
Get velocity only
get_local_pose()
np.ndarray or None
Get local pose only
get_global_pose()
np.ndarray or None
Get global pose only
get_camera_intrinsics()
np.ndarray or None
Get camera intrinsics only
get_color_image()
bytes or None
Get color image bytes only
get_depth_image()
np.ndarray or None
Get depth array only
close()
None
Close connection
Note:
The subscriber is iterable, so you can use
for data in sub:to receive frames continuously.All
get_*()methods accept an optionaltimeoutparameter (default: 1000ms).
ARFrame
Data object returned by get() or when iterating. For data format details, see AR Data Format Reference above.
Properties:
Property
Type
Description
timestamp
float
Unix timestamp in seconds
velocity
np.ndarray
Velocity $[v_x, v_y, v_z]$ in m/s
local_pose
np.ndarray
Local pose $[t_x, t_y, t_z, q_x, q_y, q_z, q_w]$
global_pose
np.ndarray
Global pose $[t_x, t_y, t_z, q_x, q_y, q_z, q_w]$
camera_intrinsics
np.ndarray
Camera intrinsics (3×3 flattened)
Color Image
color_bytes
bytes
JPEG image bytes (for saving/forwarding)
color_array
np.ndarray
Decoded RGB image array (640×480×3)
color
np.ndarray
Shortcut for color_array
Depth Image
depth_array
np.ndarray
Depth image array (uint16, 256×192)
depth
np.ndarray
Shortcut for depth_array
depth_width
int
Depth image width (256)
depth_height
int
Depth image height (192)
Helpers
has_color_image
bool
Check if color image exists
has_depth_image
bool
Check if depth image exists
Methods:
Method
Returns
Description
show_color(window_name)
bool
Display color image with OpenCV
show_depth(window_name, colormap)
bool
Display depth image with colormap
show_images(show_color, show_depth)
tuple
Display both images side by side
Last updated
Was this helpful?