Choose Line

This function block helps you pick a single line from inside a contour and provides geometric information about that line. It visualizes the contour and its points, lets you select which segment to measure, and outputs the line shape, end points, length and angle β€” all in an easy-to-use interface for non-coders.

πŸ“₯ Inputs

Image Any The image where the contour and selected line will be drawn and shown.

Contour The contour (shape) from which a line segment is chosen.

(These are the input sockets for the block.)

πŸ“€ Outputs

Generic Image The image with the contour, points and the chosen line drawn for visual confirmation.

Length The measured length of the chosen line segment in pixels.

Point 1 Coordinates of the first end point of the chosen line.

Point 2 Coordinates of the second end point of the chosen line.

Angle Orientation of the chosen line in degrees.

Line The selected line represented as a shape output.

(These are the output sockets the block provides.)

πŸ•ΉοΈ Controls

Line selection dropdown Choose which consecutive point pair (line) inside the contour to use.

Line properties label Shows textual information about the currently selected line, such as end points, length and angle.

(These controls appear on the block interface and are interactive.)

🎯 Features

  • Interactive contour visualization with all contour points marked.

  • Simple dropdown to pick one line segment formed by consecutive contour points.

  • Immediate visual feedback: contour, points and selected line are drawn on the output image.

  • Numeric outputs for length and angle so you can feed measurements into further processing.

  • Produces a shape output representing the chosen line for downstream blocks that accept shapes.

βš™οΈ How it runs

  • When a valid Contour is provided, the block lists selectable line segments based on the contour points.

  • The block draws the contour and marks each point. Selecting an entry from the Line selection dropdown highlights the corresponding segment.

  • The block computes the Euclidean distance between the two selected points and the line angle, updates the Line properties label and returns the visual image and numeric shape/point outputs.

  • If no contour is present the block returns the input image unchanged and resets the text in the properties label.

πŸ“ How to use

  1. Provide a processed image to Image Any (usually an image where contours are already found).

  2. Provide the contour shape to Contour (for example from a contour detection block).

  3. Open the Line selection dropdown and pick the desired segment to inspect.

  4. Read the measurement outputs Length, Point 1, Point 2 and Angle or pass Line to downstream blocks.

πŸ’‘ Tips and Tricks

  • Use the Find Contour block to supply reliable contours into the Contour input.

  • If you need a simpler contour before choosing a line, try Approximate Contour to reduce the number of points and make selection easier.

  • To inspect a cropped area only, precede this block with Image ROI Select or Get ROI so the contour and line are measured in the region that matters.

  • To extract the chosen line area for further processing (for example template matching or histogram checks), feed the Generic Image output into blocks like Contour to Image or Image ROI.

  • Combine with Draw Line, Draw Point or Draw Rectangle blocks if you want to overlay additional annotations on the output image before presenting or saving.

  • Feed numeric outputs such as Length and Angle into analysis or logging blocks (for example CSV Export or Data to JSON) to record measurement results.

πŸ› οΈ Troubleshooting

  • If the dropdown shows no selectable lines, confirm that a valid contour was provided by the previous block (contour should contain multiple points).

  • If selected indices seem out of range, try running a contour simplification (Approximate Contour) or ensure the input image and contour correspond to the same crop/coordinate space.

  • If measurements seem incorrect, verify that the image used was not resized or padded earlier in the flow; if it was, use matching ROI or resize steps so coordinates align.

Last updated

Was this helpful?