# Image AutoRotator

This function block automatically rotates images based on their content orientation. It analyzes the image and determines the appropriate angle to achieve a corrected orientation.

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

`Image Any` This input accepts any image data that needs to be auto-rotated based on its content.

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

`Image Any` The output provides the auto-rotated version of the input image.

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

This function block does not have specific controls. However, it runs automatically upon receiving an image input.

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

`Centroid Calculation` Automatically calculates the center of mass of the image to determine how it should be oriented.

`Angle Determination` Computes the angle by which the image needs to be rotated to achieve the desired upright position.

`Automatic Processing` The rotation process is performed automatically when an image is supplied, requiring no additional user input.

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

1. **Connect Image Source**: Link any function block that produces image data to the input.
2. **Run the Block**: Execute the block to receive an auto-rotated version of the image based on its content orientation.

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

When executed, this function block analyzes the input image and outputs the auto-rotated version, improving its orientation.

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

<details>

<summary>Multiple Images</summary>

If the task involves rotating multiple images, connect a `Batch Processing` block to handle them efficiently through this AutoRotator.

</details>

<details>

<summary>Preprocessing Images</summary>

For better results, consider using image preprocessing techniques like `Blur` to remove any noise before auto-rotation. This can help in accurate centroid and angle calculation.

</details>

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

<details>

<summary>Image Not Rotating Properly</summary>

If the rotation does not seem accurate, ensure that the input image is of good quality and has clear features for analysis. Check for sufficient contrast between the foreground and background.

</details>
