# Structural Similarity

This function block is designed to evaluate the similarity between two images using the Structural Similarity Index (SSIM). It outputs a similarity percentage indicating how closely the two images match.

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

`Image Any` The first image for comparison.

`Image Any` The second image to compare against the first image.

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

`Similarity Percentage` A numeric output representing the similarity percentage between the two input images. The closer this value is to 100%, the more similar the images are.

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

This block does not have any controls for user input; it operates based on the connected images.

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

`Grayscale Conversion` Automatically converts color images to grayscale for similarity computation, thus simplifying the process.

`Similarity Scoring` Outputs a percentage that quantifies the similarity, making it easy to gauge the match quality.

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

1. **Connect Images**: Link two images to the inputs. Ensure both images are of the same size for the comparison to be valid.
2. **Evaluate**: Run the block. It will compute the similarity and provide the output percentage.

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

Upon execution, this function block will compare the two input images and give a similarity score. If the images match closely, the output will be near 100%.

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

<details>

<summary>Handling Different Sizes</summary>

Ensure that both images have the same dimensions. If they do not, consider using the `Image Resize` function block to adjust their sizes before using this block.

</details>

<details>

<summary>Image Quality Considerations</summary>

Higher quality images typically yield better similarity scores. When working with images of varying quality or compression levels, results may vary.

</details>

<details>

<summary>Using Preprocessing</summary>

To improve similarity results for images with noise or other artifacts, consider using a `Denoising` function block before applying the structural similarity comparison.

</details>

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

<details>

<summary>Invalid Input Sizes</summary>

If you encounter an error about image size, verify that both input images are of identical dimensions. You may need to resize one or both images using the `Image Resize` function.

</details>

<details>

<summary>No Similarity Output</summary>

If the output is `None`, ensure both input images are provided and are valid. Additionally, check the shapes of the input images to confirm they match.

</details>
