DeepStereo: MiDaS Depth Estimator
This node is why you can turn any photo into a Magic Eye without painting depth
- image
- depth_map
- original_image
The headline feature of this pack is "AI-powered autostereograms," and this is the node that makes that true. The MiDaSDepthEstimator looks at a flat photo and writes a grayscale depth map - bright pixels near, dark pixels far - and that map is exactly the height-field an autostereogram needs. No hand-painting, no 3D scene, no depth sensor. One image in, a depth map out, and everything downstream in the DeepStereo pack runs off it.
It's built on Intel ISL's MiDaS, the model that shipped with SD 2.0's depth2img and was the default depth ControlNet preprocessor for years. Not the newest depth model in the world - Depth Anything V2 is the usual recommendation for ControlNet these days - but for feeding a stereogram, MiDaS's sharp edges are exactly what you want, and the pack integrates it natively.
How it works
Pick a model_type from three: MiDaS_small (default, fast, fine for previews), DPT_Hybrid (middle ground), and DPT_Large (best quality - the README's recommendation for final renders). On first use the node downloads the weights through torch.hub from the intel-isl/MiDaS repo and caches them in ComfyUI's models/controlnet/midas_models directory, so the first run needs internet and patience (the DPT models are a couple hundred megabytes). It runs on CUDA if you have it.
Under the hood it's more than a bare estimator. MiDaS outputs inverse depth, so the node flips it, normalizes it, and then exposes the processing knobs that matter for stereograms:
process_width- downscale to a processing width (rounded to multiples of 32) to speed up inference;0uses the original size.contrast,brightness,gamma- tune the map's shape right at the source, no separate pass needed.depth_min/depth_max- clip the depth range and renormalize; pull them inward to make the pop stronger.invert_depth- flip near/far. Fixes the "everything looks punched into the screen" failure.blur_radius- Gaussian smoothing for noisy maps.normalize_depth(default on) - re-stretch the map to the full range after adjustments; turn it off if you want to keep a specific tonal envelope.
Two outputs: depth_map (the IMAGE you wire into StereogramGenerator or RandomDotStereogramGenerator) and original_image, a pass-through of what you fed in - handy when you want the source and its depth to travel together without an extra reroute.
Troubleshooting
The first-run download is the classic hangup. If the node errors on load, check that ComfyUI has internet access and that models/controlnet is writable - that's where it stashes weights. If your stereogram comes out flat, the map is probably low-contrast: raise contrast or squeeze depth_min/depth_max. If it pops the wrong direction, invert_depth.
Installing it
The node needs the whole pack:
cd ComfyUI/custom_nodes
git clone https://github.com/SanDiegoDude/ComfyUI-DeepStereo
cd ComfyUI-DeepStereo
pip install -r requirements.txt
Restart ComfyUI, or install via ComfyUI Manager (search ComfyUI-DeepStereo). Note the README's own clone command has a placeholder yourusername/... URL - the real repo is the one above. And unlike the pack's utility nodes, this one does fetch weights on first run, so budget a download before your first workflow.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| model_type | COMBO | MiDaS_small | 3 options: MiDaS_small, DPT_Large, DPT_Hybrid |
| process_widthopt | INT | 00–2048 | Width for processing (0 = use original size) |
| invert_depthopt | BOOLEAN | false | Invert depth values |
| contrastopt | FLOAT | 1.00.1–3 | Adjust depth map contrast |
| brightnessopt | FLOAT | 0.00-1–1 | Adjust depth map brightness |
| gammaopt | FLOAT | 1.00.1–3 | Gamma correction |
| depth_minopt | FLOAT | 0.000–1 | Minimum depth value |
| depth_maxopt | FLOAT | 1.000–1 | Maximum depth value |
| blur_radiusopt | INT | 00–20 | Blur radius for smoothing |
| normalize_depthopt | BOOLEAN | true | Normalize depth to full range after adjustments |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| depth_map | IMAGE | — |
| original_image | IMAGE | — |