PIXELBANKv8.2.1
Menu

Map Point Visibility Test

HardSLAM

Implement a visibility test for map points in visual SLAM to determine if a point is visible from a given camera pose. This involves evaluating the point's projection onto the image plane and checking various conditions for visibility.

The concept of visibility is crucial in SLAM as it allows for efficient tracking of map points by only considering those that are currently visible. A map point is considered visible if it projects within the image bounds, has a positive depth value, and its viewing angle is within a certain threshold. The pinhole camera model is often used to describe this projection, where a 3D point PP is projected onto the image plane using the camera's intrinsic parameters KK and extrinsic parameters RR and tt.

To determine visibility, the following steps are taken:

  1. Transform the map point to the camera's coordinate system using Pcam=RP+tP_{cam} = R \cdot P + t.
  2. Check if the point has a positive depth value.
  3. Project the point onto the image plane using p=KPcamp = K \cdot P_{cam}.
  4. Calculate the image coordinates u=p0p2u = \frac{p_0}{p_2} and v=p1p2v = \frac{p_1}{p_2}.
Pcam=RP+tp=KPcamu=p0p2v=p1p2\begin{aligned} P_{cam} &= R \cdot P + t \\ p &= K \cdot P_{cam} \\ u &= \frac{p_0}{p_2} \\ v &= \frac{p_1}{p_2} \end{aligned}

This technique is widely used in autonomous vehicles and robotics for SLAM and 3D reconstruction.

Example:

Input:
map_point = [0, 0, 5]  # 5m in front
camera_pose = [identity_R, zero_t]
K = [[500,0,320],[0,500,240],[0,0,1]]
image_size = (480, 640)
Output:
{'visible': True, 'projection': [320, 240], 'depth': 5.0}
Reasoning:
  1. Transform point to camera coords: [0,0,5]
  2. Depth = 5 > 0 ✓
  3. Project: [320, 240] - center of image ✓
  4. Within image bounds ✓ → Point is visible

Constraints:

  • map_point: 3D point [X, Y, Z]
  • camera_pose: [R, t] camera extrinsics
  • K: Camera intrinsics
  • image_size: (H, W)
  • Return: Dict with 'visible', 'projection', 'depth'
Editor

Test Results

0/0
Run code to see test results.