# 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 <a href="#inputs" id="inputs"></a>

`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 <a href="#outputs" id="outputs"></a>

`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 <a href="#controls" id="controls"></a>

`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 <a href="#features" id="features"></a>

* 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 <a href="#usage" id="usage"></a>

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 <a href="#evaluation" id="evaluation"></a>

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 <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* 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 <a href="#troubleshooting" id="troubleshooting"></a>

* 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.augelab.com/function-blocks/detections-shapes/draw/draw-line.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
