MCPcopy Create free account
hub / github.com/Improbable-AI/VisionProTeleop / draw_camera

Function draw_camera

utils/visualize_tracking.py:195–215  ·  view source on GitHub ↗

Draw a single camera with its coordinate frame and viewing direction.

(T_head_camera: np.ndarray, label: str, cam_scale: float)

Source from the content-addressed store, hash-verified

193 return
194
195 def draw_camera(T_head_camera: np.ndarray, label: str, cam_scale: float):
196 """Draw a single camera with its coordinate frame and viewing direction."""
197 # T_head^camera transforms points from head to camera
198 # To get camera pose in head frame, we need the inverse: T_camera^head
199 T_camera_in_head = np.linalg.inv(T_head_camera)
200
201 # Now transform from head frame to world frame
202 T_world_camera = head_matrix @ T_camera_in_head
203
204 # Draw coordinate frame
205 draw_coordinate_frame(ax, T_world_camera, label, cam_scale)
206
207 # Draw viewing direction (camera looks in -Z direction in ARKit convention)
208 origin = get_position(T_world_camera)
209 # -Z direction is the viewing direction
210 look_dir = -T_world_camera[:3, 2] # Negative Z axis
211 look_end = origin + look_dir * cam_scale * 2
212
213 # Draw a dashed cyan line for viewing direction
214 ax.plot([origin[0], look_end[0]], [origin[1], look_end[1]], [origin[2], look_end[2]],
215 'c--', linewidth=1.5, alpha=0.7)
216
217 # Get head-to-camera transform
218 left_h2c = extrinsic.get("leftHeadToCamera")

Callers 1

draw_camera_frameFunction · 0.85

Calls 3

draw_coordinate_frameFunction · 0.85
get_positionFunction · 0.70
invMethod · 0.45

Tested by

no test coverage detected