ComfyUI Extension
ComfyUI-HappNodeSet
NODES: AutoCrop, ColorQuantizer, ExtractBlack, ExtractBlackAdvanced, RasterToUniformSVG, ... (10 total)
mikemojen/ComfyUI-HappNodeSet
Nodes21
On cloudLocal install
Categoryimage/transform, image/preprocessing
Stars0
Updated2 months ago
Nodes (21)
Auto Crop
image/transform
Color Quantizer
image/preprocessing
Contour Endpoint Visualizer
image/contour
Contour Gap Closer
image/contour
CSV Value Extractor
utils
Dashed to Solid Line
image/processing
Extract Black
image/processing
Extract Black Advanced
image/processing
Extract Red
image/processing
Hole Counter (Robust)
Laser/Path
Laser Cutter Path Tracer
Laser/Path
Line Detector
image/analysis
Line Length Calculator
diagram-analysis
Non-White to Black
image/color
Number String Cleanup
utils/string
Raster To Uniform SVG
image/conversion
Round Down
math
Round Up
math
SVG Dimensions
utils/svg
SVG PathLength
utils/svg
SVG Detailed PathLength
utils/svg
Readme
ComfyUI-HappNodeSet
Custom nodes for ComfyUI
Installation
Method 1: ComfyUI Manager
Search for "HappNodeSet" in ComfyUI Manager and install.
Method 2: Manual Installation
cd ComfyUI/custom_nodes
git clone https://github.com/mikemojen/ComfyUI-HappNodeSet.git
Requirements
If you have specific Python dependencies, install them:
pip install -r requirements.txt
Nodes
ComfyUI Line Counter & Measurer
A ComfyUI custom node package that detects, counts, and measures straight/dashed lines in images.
Features
- Line Detection: Automatically detects all straight and dashed lines in an image
- Line Counting: Counts the total number of distinct lines
- Length Measurement: Measures each line's length in pixels
- 4-Way Junction Resolution: Intelligently handles crossing lines by pairing collinear segments
- Visualization: Creates a stitched image showing each line separately with its length
Algorithm
The node uses a sophisticated 7-step algorithm:
- Preprocessing: Grayscale → Binary threshold → Noise cleanup
- Skeletonization: Thin all lines to 1-pixel width
- Graph Building: Identify junction points and endpoints
- Junction Classification: Count connections at each junction
- 4-Way Junction Resolution: Pair collinear segments at crossings
- Line Extraction: Trace through graph following pairing rules
- Measurement & Export: Calculate lengths and generate visualizations
Installation
-
Clone or copy this folder to your ComfyUI
custom_nodesdirectory:cd ComfyUI/custom_nodes git clone <repo_url> comfyui_line_counter # OR cp -r /path/to/comfyui_line_counter ./ -
Install dependencies:
pip install -r comfyui_line_counter/requirements.txt -
Restart ComfyUI
Nodes
LineCounter (Basic)
Inputs:
image: Input image (IMAGE)threshold(0-255, default: 128): Binary threshold valuemin_line_length(1-1000, default: 10): Minimum line length to includenoise_removal_kernel(1-11, default: 3): Kernel size for noise removalangle_tolerance(5-90°, default: 30°): Tolerance for collinearity at junctions
Outputs:
line_count(INT): Number of detected linesline_lengths(STRING): Comma-separated lengths in pixelsvisualization(IMAGE): Stitched image of individual lines
LineCounterAdvanced
Same as basic, plus:
Additional Inputs:
dashed_line_gap(0-50, default: 10): Gap size to close for dashed linesline_thickness(1-10, default: 2): Line thickness in visualization
Additional Outputs:
skeleton_debug(IMAGE): Debug view showing skeleton with junctions (red) and endpoints (green)
Usage Example
- Add a "Load Image" node
- Connect it to "Line Counter & Measurer"
- Adjust parameters as needed:
- Lower
thresholdif lines are light colored - Increase
dashed_line_gapfor dashed lines with larger gaps - Adjust
angle_toleranceif lines at small angles should be separate
- Lower
- Connect outputs to preview nodes or save nodes
Input Requirements
- Image should have dark lines on a white/light background
- Lines should be relatively straight (not curved)
- Works best with clean, high-contrast images
Tips
- For dashed lines: Increase
dashed_line_gapto connect the dashes - For noisy images: Increase
noise_removal_kernel - For crossing lines: Adjust
angle_tolerance- lower values require more exact alignment - For thin/faint lines: Lower the
thresholdvalue
Example Workflow
[Load Image] → [LineCounter] → [Preview Image (visualization)]
↘ [Show Text (line_count)]
↘ [Show Text (line_lengths)]
License
MIT License
Usage
[Add usage examples]