Nodes/ComfyUI 1hewNodes/Detect Guide Line
ComfyUI Node

Detect Guide Line

Find the vanishing point and draw the composition's guide lines

By 1hew·Created about a year ago·Updated 13 days ago· 34
Detect Guide Line
  • image
  • image
  • line_image
  • line_mask
◄canny_low0.20►
◄canny_high0.80►
◄seg_min_len40►
◄seg_max_gap8►
◄guide_filter0.6►
◄guide_width2►
◄cluster_eps30►

Detect Guide Line (1hew_DetectGuideLine) is the pack's most unusual detection node, and it's aimed at composition nerds: it finds the image's dominant vanishing point and draws red guide lines converging on it - the classic one-point-perspective diagram. If you've ever wanted to check whether a generated image's perspective actually converges, or feed a photo's perspective structure into an analysis pipeline, this is the node.

It's in the 1hewNodes/detect group, and it's the only node in this pack that's about understanding an image's geometry rather than segmenting it. Think photography critique, perspective-checking on AI images, or a preprocessor that hands guide-line masks to something downstream.

How it works

It's a real vision pipeline, not a gimmick, and it reads like a textbook exercise:

  1. Canny edge detection on a blurred grayscale (canny_low/canny_high, 0–1).
  2. HoughLinesP extracts line segments (seg_min_len minimum length, seg_max_gap gap tolerance).
  3. Every pair of segments is extended and their intersection points collected.
  4. DBSCAN clusters those intersections (cluster_eps); the largest cluster's centroid becomes the vanishing point.
  5. Lines are scored by how well they aim at that point, filtered by guide_filter (higher = stricter, fewer lines kept), and drawn in red at guide_width thickness from the segment outward toward the vanishing point.

It's a genuine vanishing-point detector, and for clean architectural/road scenes it works shockingly well. It runs per image, concurrent across a batch.

Inputs and outputs

  • image - the input.
  • canny_low / canny_high - edge thresholds, defaults 0.2 / 0.8.
  • seg_min_len - minimum line segment length (40).
  • seg_max_gap - max gap to bridge between segments (8).
  • guide_filter - strictness of the alignment filter (0.6).
  • guide_width - drawn line thickness (2).
  • cluster_eps - DBSCAN cluster radius for intersections (30).
  • image - input with red guide lines + vanishing point drawn over it.
  • line_image - just the guide lines on black.
  • line_mask - the same lines as a mask.

Installing it

It's part of the 1hewNodes pack:

cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes

or via ComfyUI Manager ("1hewNodes"), then restart. It needs OpenCV and scikit-learn, both in the pack requirements.

The honest take

This is a niche node with a real failure mode: it only finds one vanishing point. Genuinely two-point or three-point perspective images will confuse it - it'll still pick the largest cluster and draw lines converging somewhere, but the diagram will be wrong. It also wants strong straight edges; a portrait or a forest will produce a near-random vanishing point. Where it shines is roads, buildings, rail lines - the one-point-perspective stock photos that make up half of reference libraries. For those, it's a genuinely cool little tool, and the line_mask output is the most useful part: it gives you the perspective structure as a mask you can actually consume elsewhere.

Category1hewNodes/detect

Inputs (8)

NameTypeDefaultDescription
imageIMAGE—
canny_lowFLOAT0.200–1—
canny_highFLOAT0.800–1—
seg_min_lenINT401–300—
seg_max_gapINT81–100—
guide_filterFLOAT0.60.1–1—
guide_widthINT21–100—
cluster_epsINT301–100—

Outputs (3)

NameTypeDescription
imageIMAGE—
line_imageIMAGE—
line_maskMASK—