# Draw Result On Image

This function block overlays a textual result on an input image based on a boolean condition. It is useful for annotating pass/fail states, status messages, or any binary result directly onto the image before further processing or display.

## 📥 Inputs (sockets) <a href="#inputs" id="inputs"></a>

`Image` (Input socket) The image that will receive the overlaid text.\
`Condition` (Input socket) A boolean value that determines which text and color will be drawn.\
`Success Condition Text` (Input socket) Text to display when the condition is true.\
`Fail Condition Text` (Input socket) Text to display when the condition is false.

## 📤 Outputs (sockets) <a href="#outputs" id="outputs"></a>

`Image` (Output socket) The resulting image with the overlaid text.

## 🕹️ Controls <a href="#controls" id="controls"></a>

`Font Scale` Adjusts the relative font size of the overlaid text to fit different image resolutions.\
`Horizontal Position` Moves the text left/right using a simple 0..10 scale for quick placement.\
`Vertical Position` Moves the text up/down using a simple 0..10 scale for quick placement.

## 🎨 Features <a href="#features" id="features"></a>

* Visual pass/fail feedback: when the `Condition` is true the block draws the `Success Condition Text` in green; otherwise it draws the `Fail Condition Text` in blue.
* Resolution-aware sizing: font sizing adapts to image dimensions so text remains readable on different resolutions.
* Quick placement: horizontal and vertical sliders provide fast, UI-friendly positioning without manual coordinates.

## 📝 Usage Instructions <a href="#usage" id="usage"></a>

1. Provide an image to the `Image` socket.
2. Feed a boolean signal into the `Condition` socket to indicate success or failure. You can produce this signal using logic blocks such as `Logic Input`, `Equals`, `And`, or `Greater`.
3. Optionally provide custom strings to `Success Condition Text` and `Fail Condition Text` to control the displayed messages.
4. Adjust `Font Scale`, `Horizontal Position`, and `Vertical Position` controls until the text is placed and sized as desired.
5. Use the output `Image` to continue processing, display with the `Show Image` block, or save with `Image Write` / `Image Logger`.

## 📊 Evaluation <a href="#evaluation" id="evaluation"></a>

When evaluated, the block copies the input image, chooses which text to draw based on the `Condition` socket, renders the text using the selected font scale and position settings, and returns the annotated image through the `Image` output socket.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* Combine with detection blocks such as `Object Detection`, `Object Detection - Custom`, or `Mask Detection` to show per-frame OK/NOK results (for example, show "OK" when an object is detected or "Fail" when not).
* Use `Draw Detections` in tandem to display bounding boxes and then use this block to add an overall pass/fail label.
* Use `Image ROI` or `Image ROI Select` before this block to crop to a region of interest and place text relative to that region.
* If you want to log or save annotated frames, connect the output to `Image Logger`, `Image Write`, or `Record Video`.
* Build complex conditions with logic blocks like `And`, `Or`, `Not`, or comparisons (`Greater`, `Equals`) and feed the final boolean into the `Condition` socket.

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* No text appears: ensure the `Success Condition Text` or `Fail Condition Text` sockets are set (they can be left empty but then nothing will draw).
* Text placement off-image: adjust `Horizontal Position` and `Vertical Position` sliders; increase or decrease `Font Scale` for better fit on large or small images.
* Text too small or too large: tweak `Font Scale` and preview results with the `Show Image` block to find the right balance.


---

# 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/blocks-reference/detections-shapes/draw/draw-result-on-image.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.
