ReprojectDepth
Warping depth maps between projections, with a validity mask thrown in
- depth
- transform_matrix
- reprojected_depth
- reprojected_mask
ReprojectImage handles the color; this is its twin for the depth channel. ReprojectDepth takes a depth tensor and remaps it between the pack's three projections (PINHOLE, FISHEYE, EQUIRECTANGULAR), optionally through a 4×4 camera transform, and - the part people actually appreciate - hands you back a mask of which pixels have valid depth in the new view.
Why does that mask matter? Because depth is how this pack lifts images into 3D. When you reproject a depth map into a new projection, the edges of the source view become holes in the target, and if you don't know where those holes are, you'll happily lift garbage geometry into a point cloud. The reprojected_mask output (1.0 = valid) is exactly the coverage signal you need to feed downstream nodes or to composite reprojected depth with something else.
The inputs
- depth - a depth
TENSOR; the node accepts 2D[H,W], 3D, or 4D batch layouts and normalizes them internally. - input_projection / output_projection and the two fov fields - same projection language as
ReprojectImage. Fov matters just as much here; a wrong fov warps geometry even if the image looked fine. - output_width / output_height - 0 (default) keeps the input resolution; set them to match a reprojected color image so the pair lines up pixel-for-pixel.
- transform_matrix - optional
MAT_4X4; rotate or move the camera before sampling. - inverse - invert the matrix when your poses use the other convention.
What comes out
- reprojected_depth - the depth map in the new projection.
- reprojected_mask - 1.0 where the new view actually has data, 0.0 where it sampled outside the source.
The classic usage is keeping color and depth in lockstep: run the same image through ReprojectImage and the corresponding depth through ReprojectDepth with identical projection/fov/matrix settings, and you end up with an RGB-D pair in the new view that you can hand to DepthToPointCloud.
One caveat to internalize
The pack's docs hammer on the difference between Z-depth and ray depth (radial distance). VideoPoseEstimator and the Depth-Anything metric models output Z-depth; the lifting and reprojection nodes expect ray depth. If geometry bows outward at wide fovs, you skipped the ZDepthToRayDepthNode step. ReprojectDepth itself is just resampling whatever it's given - garbage depth in, garbage depth out - so make sure the source is in the convention your downstream nodes want.
Installing it
Part of camera-comfyUI. Manager → search camera-comfyUI → Install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Alexankharin/camera-comfyUI.git
cd camera-comfyUI && python install.py
No extra dependencies for this node.
Common issues
- Depth and color don't line up - almost always mismatched projection, fov, or matrix settings between the
ReprojectImageandReprojectDepthinstances. Mirror them exactly. - Mask is all zeros at the edges - correct behavior; that's the boundary of your source view.
- Bow-shaped geometry at wide fov - Z-depth vs ray-depth mismatch upstream. Insert
ZDepthToRayDepthNode.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| depth | TENSOR | — | |
| input_horizontal_fov | FLOAT | 900–360 | — |
| output_horizontal_fov | FLOAT | 900–360 | — |
| input_projection | COMBO | input projection type | |
| output_projection | COMBO | output projection type | |
| output_width | INT | 00–16384 | — |
| output_height | INT | 00–16384 | — |
| transform_matrix | MAT_4X4 | — | |
| inverse | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| reprojected_depth | TENSOR | — |
| reprojected_mask | MASK | — |