I'm generating blurred images with different blur amounts in Unity but I don't know how much blur (spoken in absolute values or in Sigma σ) is produced. Do you know any tool which allows measuring the blur amount of an image when the original image and the blurred version is provided?

However, I would prefer if I could calculate the exact Sigma values my Gaussian blur implementation produces in order to compare absolute blur values between different images. I halfway understand the theoretical background of the Gaussian blur but I didn't write the whole implementation I use by myself, so I have a hard time to understand how the Gaussian formula is applied in this implementation and which Sigma values it produces. Can you help me with this?

I'll provide the relevant code lines which are written in C# for Unity.

Code: Select all

```
// ...
int iterations = 2; // increase to get more blur
float interpolation = 2f; // increase to get more blur
int kernel = 4;
var rt2 = RenderTexture.GetTemporary(source.width, source.height, 0, source.format);
for (int i = 0; i < iterations; i++)
{
float radius = (float)i * interpolation + interpolation; // I think this is the crucial line affecting resulting Sigma value (?)
blurMaterial.SetFloat(Uniforms._Radius, radius);
Graphics.Blit(source, rt2, blurMaterial, 1 + kernel);
source.DiscardContents();
// is it a last iteration? If so, then blit to destination
if (i == iterations - 1)
{
Graphics.Blit(rt2, destination, blurMaterial, 2 + kernel);
} else {
Graphics.Blit(rt2, source, blurMaterial, 2 + kernel);
rt2.DiscardContents();
}
}
RenderTexture.ReleaseTemporary(rt2);
}
// ...
```

Code: Select all

```
// ...
output_13tap vert13Horizontal (vertexInput IN)
{
output_13tap OUT;
OUT.vertex = UnityObjectToClipPos(IN.vertex);
float2 offset1 = float2(_MainTex_TexelSize.x * _Radius * 1.41176470, 0.0);
float2 offset2 = float2(_MainTex_TexelSize.x * _Radius * 3.29411764, 0.0);
float2 offset3 = float2(_MainTex_TexelSize.x * _Radius * 5.17647058, 0.0);
#if UNITY_VERSION >= 540
float2 uv = UnityStereoScreenSpaceUVAdjust(IN.uv, _MainTex_ST);
#else
float2 uv = IN.uv;
#endif
OUT.texcoord = uv;
OUT.blurTexcoord[0].xy = uv + offset1;
OUT.blurTexcoord[0].zw = uv - offset1;
OUT.blurTexcoord[1].xy = uv + offset2;
OUT.blurTexcoord[1].zw = uv - offset2;
OUT.blurTexcoord[2].xy = uv + offset3;
OUT.blurTexcoord[2].zw = uv - offset3;
return OUT;
}
// Does the same again with _MainTex_TexelSize.y for vertically blurring the image
// ...
```

Cult