4.6 KiB
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)
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
Nodes
Image To Points (Torch)
Description
GPU-accelerated version using PyTorch tensors. Maintains gradient flow and supports automatic device placement.
Input Parameters:
image: Input RGB/RGBA imagedepth_image: Depth map imagedepth: 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
Description
Applies 3D transformations to point clouds (rotation, translation, scaling).
Input Parameters:
points: Input point cloud (Points3D)rot_x/y/z: Euler angles in degreestrl_x/y/z: Translation offsetsscale_x/y/z: Axis-specific scaling factors
Output:
Points3D: Transformed point cloud (XYZ coordinates + RGB colors)
Points To Image (Orthographic)
Description
Renders 3D points to 2D image using orthographic projection.
Input Parameters:
images: Template for output dimensionspoints: Point cloud to render (Points3D)color: Enable RGB coloring
Output:
IMAGE: Rendered grayscale/RGB image
Points To Image (Projection)
Description
Perspective projection renderer with customizable FOV.
Input Parameters:
images: Template for output dimensionspoints: Point cloud to render (Points3D)color: Enable RGB coloringfov: Field of View in degrees (1-2000)
Output:
IMAGE: Rendered grayscale/RGB image
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)
Description
Removes outliers using KDTree neighborhood analysis.
Parameters:
points: Point cloud to render (Points3D)k: Minimum neighbors requiredm: Max neighbor distance threshold
Output:
Points3D: Cleaned point cloud (XYZ coordinates + RGB colors)
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 cloudvalue: (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
Description
Exports point cloud to PLY format (ASCII/binary).
Input Parameters:
points: Point cloud to render (Points3D)multiple_files: Split XYZ/RGB dataformat_out: File encoding format
Import PLY
Description
Import PLY point cloud files into compatible Point3D format. (Sperimental)
Input Parameter:
.plyfile selection
Output:
Points3D: Loaded point cloud data (XYZ coordinates + RGB colors)
Cloud Points Info
Description
Displays point cloud statistics and coordinate ranges.
Output:
STRING: Formatted summary text
DEMO FUNCTIONS
TODO
- Fix artifacts with some extreme values












