Draw Line

This function block lets you interactively mark lines directly on an image using the mouse and simple keyboard shortcuts. Use it to draw single or multiple connected lines, extract coordinates, and get angle information for each segment.

πŸ“₯ Inputs

Image Any The image where lines will be drawn. Connect any image-producing block here.

Calculate All Points When set to true, the block returns every pixel coordinate along each drawn segment instead of only end points.

πŸ“€ Outputs

Image Any The annotated image showing drawn lines or calculated points.

Line Coordinates A list of line shapes representing each drawn segment.

Angles Rotation or angle values for each line segment.

πŸ•ΉοΈ Controls

Image Area Click with the left mouse button on the image area to add points and build lines.

Press U Undo the last added point or segment.

Press C Clear all drawn points and lines.

(hint) The image area shows real-time visual feedback as you add, undo, or clear marks.

🎨 Features

  • Interactive drawing directly on the image with immediate visual feedback.

  • Keyboard shortcuts for fast editing: undo (Press U) and clear (Press C).

  • Option to return dense coordinate lists along each line when Calculate All Points is enabled.

  • Angle estimation per segment, useful for orientation or alignment tasks.

πŸ“ Usage Instructions

  1. Connect an image-producing block to the Image Any input (for example, a camera or an image loader).

  2. Click on the image area to place points. Consecutive clicks form line segments.

  3. To get every pixel coordinate along segments, provide a TRUE value to the Calculate All Points input.

  4. Use Press U to undo the last point or Press C to clear all marks.

  5. Read the outputs to obtain the annotated image, the Line Coordinates list, and Angles.

πŸ“Š Evaluation

When run, this function block updates the interactive image preview with drawn lines and computes outputs based on the current points. If Calculate All Points is enabled, the block expands each segment into its constituent pixel coordinates before returning the results.

πŸ’‘ Tips and Tricks

  • For live camera input, connect Camera USB or Stream Reader to the Image Any input to draw directly on live frames.

  • To inspect results visually in a larger window, pair this block with Show Image after the outputs.

  • If you need to restrict drawing to a specific area, crop first with Image ROI Select or Image ROI, then feed the cropped image into this block.

  • For fine-grained analysis along a drawn line, enable Calculate All Points and use Measure Position Distance or Histogram On Line on the resulting coordinates or image.

  • Reduce noise before drawing by preprocessing the input with Blur or Denoising when edges are noisy.

  • When working with very large images, use Image Resizer to lower resolution for faster interactive performance, then map coordinates back if needed.

πŸ› οΈ Troubleshooting

  • No drawing response: ensure a valid image is connected to the Image Any input and the scenario is running.

  • Points not aligned as expected: zoom or resize the image source consistently between preview and downstream usage, or crop with Image ROI Select before drawing.

  • Too many coordinates returned: disable Calculate All Points if you only need segment endpoints, or resize the image to reduce point density.

Last updated

Was this helpful?