OpenCV reprojectImageTo3D_0
Turn a disparity map into 3D points — reprojectImageTo3D_0
- disparity
- Q
- _3dImage
- nparray
reprojectImageTo3D_0 is the stereo-vision payoff node: it takes a disparity map and a calibration matrix, and hands you back a per-pixel (X, Y, Z) point cloud. If you've ever wanted real 3D geometry from two images instead of a neural net's depth guess, this is the classical, camera-physics way to get it - wrapped for ComfyUI by opencv-comfyui (geroldmeisinger/opencv-comfyui).
It's the final step of the classic stereo pipeline: left/right rectified images → stereo matching → a disparity map → this node → world coordinates. One honest caveat: the pack wraps standalone functions, not classes, so the stereo matchers (StereoBM, StereoSGBM) aren't in here - you'd bring your disparity map in from elsewhere. It's also the node where this pack's "not every function is useful within ComfyUI" warning is the loudest, because the ingredients are real engineering data, not something a text prompt hands you.
The inputs that matter
disparity-NPARRAY, a single-channel disparity map, typically 8-bit or 16-bit signed. Garbage in, garbage out; the disparity has to come from an actual stereo matcher on rectified pairs.Q-NPARRAY, a 4×4 reprojection matrix from stereo calibration. This is theQthatstereoRectifyproduces, and you don't just guess it - it encodes your camera geometry. Without a real one, the "3D" output is meaningless.handleMissingValues- boolean. IfTrue, outlier pixels where disparity wasn't computed are projected to a very large Z (OpenCV sets it to 10000) so you can filter them out later. Leave it off unless you're deliberately hunting for holes.ddepth- output depth as an int.5(CV_32F, float) is the usual choice._3dImage- optional out-parameter; leave it unconnected.
Output is a single nparray: a three-channel image where each pixel holds (X, Y, Z) coordinates. Important reality check: this is data, not a picture. It's float coordinates, not color, so feeding it to Nparrays2Image produces visual garbage. It's meant to be consumed as geometry - written to a file, converted to a mesh, or analyzed numerically.
Installing it
ComfyUI Manager (search "opencv-comfyui"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
restart, and confirm OpenCV:
pip install opencv-contrib-python
No models, no GPU.
The honest take
For 99% of ComfyUI users, this node will sit unused, and that's fine. Real 3D reprojection needs a calibrated stereo rig - two cameras, intrinsic/extrinsic calibration, rectified pairs. If you have that, this is exactly the node you want. If you're after depth from a single image, the neural-depth packs (Depth Anything, Marigold, MiDaS) are the right tools and they output an IMAGE you can actually preview. This one is for the rare workflow that already has stereo data, and it's a good example of why the author's "expect dragons" caveat exists - some of these six hundred generated nodes are only useful in very specific, technical circumstances.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| disparity | NPARRAY | — | |
| Q | NPARRAY | — | |
| handleMissingValues | BOOLEAN | — | |
| ddepth | INT | — | |
| _3dImageopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |