ComfyUI Node
CV Depth to 3D Points
Back-projects a depth map to a colored 3-D point cloud using camera intrinsics. For each pixel (u, v) with depth Z, computes X = (u - cx) * Z / fx, Y = (v - cy) * Z / fy. Unlike cv2.reprojectImageTo3D (which is for stereo disparity), this handles monocular depth directly. Feed the depth as a float32 NPARRAY (in any unit — the depth_scale converts to your desired output unit). Output is Nx3 points + Nx3 colors for 'Write PLY'.
CV Depth to 3D Points
- depth
- camera_matrix
- colors
- points
- colors
◄depth_scale1.000►
Categoryimage/CV/low-level
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| depth | NPARRAY | HxW float32 depth map. Values can be in any unit (mm, meters, raw model output) — use depth_scale to convert. Single-channel; if loaded via Image->CV (GRAY float32), the channel is already extracted. | |
| camera_matrix | NPARRAY | 3x3 camera intrinsic matrix K from Calibrate Camera (Chessboard) or CV Camera Matrix. fx=K[0,0], fy=K[1,1], cx=K[0,2], cy=K[1,2]. | |
| depth_scale | FLOAT | 1.000 | Multiplier to convert depth values to meters. E.g. 0.001 if depth is in mm, 1.0 if already in meters, 65535/1000=65.535 for NYU Depth V2 (uint16 mm loaded as float32 0-1). |
| colorsopt | NPARRAY | HxWx3 or HxW uint8/float RGB color image (same dimensions as depth). If disconnected, all points are white. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| points | NPARRAY | Nx3 float32 array of 3-D positions. |
| colors | NPARRAY | Nx3 uint8 array of per-vertex RGB colors. |