Extensions/ComfyUI_depthMapOperation
ComfyUI Extension

ComfyUI_depthMapOperation

A simple set of nodes to generate a point cloud from an image and its depth map, perform transformations and some basic operations.

By chri002·Created about a year ago·Updated about a year ago· 15
chri002/ComfyUI_depthMapOperation
Nodes13
On cloudLocal install
CategorydepthMapOperation
Stars15
Updatedabout a year ago
Readme

ComfyUI_depthMapOperation

A simple set of nodes to generate a point cloud from an image and its depth map, perform transformations and some basic operations.

Here an example of what can be done (not the gif, but the various rotations)

<div class="grid" align="center" markdown> <img src=".//assets/start.jpg" width=40%> <img src=".//assets/gif.gif" width=40%> </div>

Installation

On the console in the custom_nodes filder execute:

git clone https://github.com/chri002/ComfyUI_depthMapOperation

Requirements

these nodes require in order to function:

  • torch
  • numpy
  • opencv-python
  • scipy
  • pandas

Workflow

workflow


Nodes

Image To Points (Torch)

Image To Points

Description

GPU-accelerated version using PyTorch tensors. Maintains gradient flow and supports automatic device placement.

Input Parameters:

  • image: Input RGB/RGBA image
  • depth_image: Depth map image
  • depth: Z-axis scaling factor (1-1024)
  • quality: Downsampling quality (1=1 point:1 pixel , 16=16 interpolate points every 2 pixel)

Output:

  • Points3D: XYZ coordinates + RGB colors

Transform Points

Transform Points

Description

Applies 3D transformations to point clouds (rotation, translation, scaling).

Input Parameters:

  • points: Input point cloud (Points3D)
  • rot_x/y/z: Euler angles in degrees
  • trl_x/y/z: Translation offsets
  • scale_x/y/z: Axis-specific scaling factors

Output:

  • Points3D: Transformed point cloud (XYZ coordinates + RGB colors)

Points To Image (Orthographic)

Points To Image (Orthographic)

Description

Renders 3D points to 2D image using orthographic projection.

Input Parameters:

  • images: Template for output dimensions
  • points: Point cloud to render (Points3D)
  • color: Enable RGB coloring

Output:

  • IMAGE: Rendered grayscale/RGB image

Points To Image (Projection)

Points To Image (Projection)

Description

Perspective projection renderer with customizable FOV.

Input Parameters:

  • images: Template for output dimensions
  • points: Point cloud to render (Points3D)
  • color: Enable RGB coloring
  • fov: Field of View in degrees (1-2000)

Output:

  • IMAGE: Rendered grayscale/RGB image

Cube Limit

Cube Limit

Description

Filters points within relative cube dimensions (0-100% of original bounds).

Input Parameters:

  • points: Point cloud to render (Points3D)
  • 6 axis range parameters (x_min-x_max, etc.)

Output:

  • Points3D: Subset of points within cube (XYZ coordinates + RGB colors)

Clean Points (KDTree)

EClean Points (KDTree)

Description

Removes outliers using KDTree neighborhood analysis.

Parameters:

  • points: Point cloud to render (Points3D)
  • k: Minimum neighbors required
  • m: Max neighbor distance threshold

Output:

  • Points3D: Cleaned point cloud (XYZ coordinates + RGB colors)

Interpolate Points (KDTree)

Interpolate Points (KDTree)

Description

Generates new points through neighborhood-based interpolation using KDTree. Enhances point cloud density in sparse regions by creating intermediate points between existing neighbors.

Input Parameters:

  • points: Input 3D point cloud
  • value: (0-1) Blend ratio for new points (0=keep original, 1=full interpolation)
  • n: Number of nearest neighbors to consider (0-32)

Output:

  • Points3D: Point cloud with added interpolated points (XYZ coordinates + RGB colors)

Export To PLY

Export To PLY

Description

Exports point cloud to PLY format (ASCII/binary).

Input Parameters:

  • points: Point cloud to render (Points3D)
  • multiple_files: Split XYZ/RGB data
  • format_out: File encoding format

Import PLY

Import PLY

Description

Import PLY point cloud files into compatible Point3D format. (Sperimental)

Input Parameter:

  • .ply file selection

Output:

  • Points3D: Loaded point cloud data (XYZ coordinates + RGB colors)

Cloud Points Info

Cloud Points Info

Description

Displays point cloud statistics and coordinate ranges.

Output:

  • STRING: Formatted summary text

DEMO FUNCTIONS

<a target="_blank" href="https://colab.research.google.com/github/chri002/ComfyUI_depthMapOperation/blob/main/test.ipynb"> <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Test In Colab" height="30px"/> </a>

TODO

  • Fix artifacts with some extreme values