Detect Guide Line
Find the vanishing point and draw the composition's guide lines
- image
- image
- line_image
- line_mask
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:
- Canny edge detection on a blurred grayscale (
canny_low/canny_high, 0–1). - HoughLinesP extracts line segments (
seg_min_lenminimum length,seg_max_gapgap tolerance). - Every pair of segments is extended and their intersection points collected.
- DBSCAN clusters those intersections (
cluster_eps); the largest cluster's centroid becomes the vanishing point. - Lines are scored by how well they aim at that point, filtered by
guide_filter(higher = stricter, fewer lines kept), and drawn in red atguide_widththickness 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.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| canny_low | FLOAT | 0.200–1 | — |
| canny_high | FLOAT | 0.800–1 | — |
| seg_min_len | INT | 401–300 | — |
| seg_max_gap | INT | 81–100 | — |
| guide_filter | FLOAT | 0.60.1–1 | — |
| guide_width | INT | 21–100 | — |
| cluster_eps | INT | 301–100 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| line_image | IMAGE | — |
| line_mask | MASK | — |