Nodes/camera-comfyUI/DepthToImageNode
ComfyUI Node

DepthToImageNode

Actually look at the depth map you just made

By Alexankharin·Created about a year ago·Updated about a month ago· 36
DepthToImageNode
  • depth
  • depth image
invert_depthfalse

Depth maps are invisible. You generate one and the tensor sits there, abstractly promising geometry, and you can't see whether it's good or garbage. DepthToImageNode is the two-second sanity check every depth pipeline should have: it converts your depth tensor into an actual grayscale image you can preview, inspect, and save.

It's the smallest node in this pack, and it deserves a permanent spot in your graph for the same reason every debug view deserves a place in a ComfyUI workflow: you cannot fix what you cannot see. Any time you feed a depth map into a point cloud or splat pipeline and the result looks wrong, the first question is "what did the depth actually look like?" - this node answers it.

What it does

Feed it a depth tensor (the (B,H,W,1) float output of DepthEstimatorNode or FisheyeDepthEstimator) and it returns a depth image (IMAGE). The conversion normalizes by min-max when no range is given, so the map stretches to full black-to-white contrast - which is exactly what you want for a preview, even if it means the "absolute" values are hidden. Convention reminder from the depth knowledge base: in the standard grayscale view, white is close, black is far.

The one real control is invert_depth (default off). Flip it on and near becomes far, which does two useful things: it matches the "dark = close" convention some tools and viewers expect, and it makes the preview read better for certain scenes (sky-heavy shots, for example, where the original normalization crushes the background).

That's it. One input, one output, no models, no tuning. If you're after a colored depth visualization, this isn't that node - it's strictly grayscale - but for judging geometry quality, grayscale is the honest format anyway.

How to use it well

  • Wire it in parallel off your depth estimator (right-click → convert to reroute if you don't want to disconnect the real path) so every estimate gets a live preview.
  • Save the output with a SaveImage node when you're iterating on a pipeline and want to compare runs side by side.
  • Use it to sanity-check the direction: if a photo of a room renders with the far wall white and the foreground black, you've got an inverted depth somewhere upstream - this node's invert_depth or the invert_depth flag on DepthToPointCloud can fix it at either end.

Install

Shared camera-comfyUI install: ComfyUI Manager → search "camera-comfyUI" → Install, or clone https://github.com/Alexankharin/camera-comfyUI into custom_nodes/ and run python install.py. Pure numpy normalization - no dependencies beyond the pack itself, works even if every heavy optional dep failed.

Troubleshooting

  • Preview is all white or all black: the depth tensor has a degenerate range (all zeros, or NaN). Check upstream - a failed depth estimate produces exactly this.
  • The image looks banded/posterized: that's the source map, not the node; a median blur upstream (median_blur_kernel on the estimator) smooths it.
  • "Why does my visualization not match my point cloud?": because min-max normalization hides absolute scale. The preview is for shape, not for units - trust the tensor for units.
CategoryCamera/Depth

Inputs (2)

NameTypeDefaultDescription
depthTENSOR
invert_depthBOOLEANfalseInvert the depth map values

Outputs (1)

NameTypeDescription
depth imageIMAGE