# Image AutoRotator

This function block automatically orients an image so its main content appears upright. It is useful when images may be rotated during capture and you want a consistent orientation before further processing.

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

`Image Any` The input accepts any image that you want to auto-rotate.

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

`Image Any` The output is the rotated image adjusted to a more upright orientation.

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

This block has no user-facing controls. It runs automatically when an image is provided.

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

* Automatic orientation correction for images with a dominant axis or elongated object.
* Transparent operation — no manual tuning is required for typical use cases.
* Fast, single-step processing suitable for live streams or batch images.

## ⚙️ Running mechanism <a href="#running-mechanism" id="running-mechanism"></a>

When an image is provided to the block, it analyzes the image to determine the main orientation and returns a version rotated to align that main axis vertically. This happens each time the block is evaluated, so you receive an updated, oriented image whenever the input changes.

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

1. Connect an image-producing block to the `Image Any` input.
2. The block will output the rotated image on the `Image Any` output.
3. Use the rotated image with downstream blocks for reliable measurements or visualization.

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

* Preview results quickly by connecting the output to `Show Image` to confirm correct orientation.
* If images are large and slow to process, pair with `Image Resizer` before this block to speed up evaluation.
* When you expect only a small region to determine orientation, crop first with `Image ROI Select` and run this block on the ROI for more robust results.
* Use `Blur` or `Image Threshold` before auto-rotation when noise or background clutter confuse orientation detection — preprocessing can improve stability.
* If you need a fixed manual rotation after auto-orienting, chain with `Rotate Image Angle` to apply a custom tweak.

(hint: combine these with other analysis and detection blocks such as `Find Object` or `Histogram On Line` to ensure downstream processing uses consistently oriented images.)

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

* If output looks unchanged or still slanted, try preprocessing the input with `Blur` or `Image Threshold` to reduce background noise.
* If the subject fills only a small portion of the image, crop with `Image ROI Select` so the block analyzes the relevant area.
* For very large images that are slow to process, resize with `Image Resizer` to balance speed and accuracy.


---

# 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/image-transformations/operations/image-autorotator.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.
