# Auto Contrast

This function block applies automatic contrast adjustments to images using a histogram clipping algorithm. The goal is to enhance the visibility of features within the image.

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

`Image Any` The input image that you want to enhance through contrast adjustment.

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

`Image Any` The output image with adjusted contrast.

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

`Threshold` A slider control that allows you to set the percentage of histogram clipping to apply. This value determines how much of the histogram's tails are clipped to increase contrast.

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

`Automatic Adjustment` This block automatically adjusts image contrast based on the histogram data, enhancing image features without manual intervention.

`Histogram Clipping` The algorithm calculates the minimum and maximum grayscale values to clip, allowing greater detail in the remaining image data.

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

1. **Connect Input**: Link a source image to the `Image Any` input.
2. **Set Threshold**: Use the `Threshold` slider to adjust the histogram clipping percentage. A typical range is between 1 and 99.
3. **Evaluate**: Run the block to apply the contrast adjustment and get the enhanced output image.

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

Upon evaluation, this function block processes the input image and enhances its contrast based on the set threshold, outputting the adjusted image.

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

<details>

<summary>Optimal Threshold Settings</summary>

Experiment with the `Threshold` slider to find an optimal setting for different images; values around 10-15% often yield good results without overly clipping the data.

</details>

<details>

<summary>Combining with Other Filters</summary>

Consider using this block in conjunction with other image transformation blocks such as `Sharpen` or `Blur` to enhance the final output quality further.

</details>

<details>

<summary>Previewing Changes</summary>

To see how the changes affect the image, connect this block to a `Show Image` block to preview the adjusted image real-time.

</details>

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

<details>

<summary>No Visible Change</summary>

If you notice no visible change in the output image, try adjusting the `Threshold`. A very low or very high value may not effectively alter the image contrast.

</details>

<details>

<summary>Input Image Issues</summary>

Ensure the input image is valid and in a supported format. Grayscale images generally yield better results with this method, but it will also work with color images.

</details>
