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
Contouris 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 dropdownhighlights the corresponding segment.The block computes the Euclidean distance between the two selected points and the line angle, updates the
Line properties labeland 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
Provide a processed image to
Image Any(usually an image where contours are already found).Provide the contour shape to
Contour(for example from a contour detection block).Open the
Line selection dropdownand pick the desired segment to inspect.Read the measurement outputs
Length,Point 1,Point 2andAngleor passLineto downstream blocks.
π‘ Tips and Tricks
Use the Find Contour block to supply reliable contours into the
Contourinput.If you need a simpler contour before choosing a line, try
Approximate Contourto reduce the number of points and make selection easier.To inspect a cropped area only, precede this block with
Image ROI SelectorGet ROIso 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 Imageoutput into blocks likeContour to ImageorImage ROI.Combine with
Draw Line,Draw PointorDraw Rectangleblocks if you want to overlay additional annotations on the output image before presenting or saving.Feed numeric outputs such as
LengthandAngleinto analysis or logging blocks (for exampleCSV ExportorData 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?