<p>What you want to do is compare your anti aliased results against a "ground truth" image.</p>

<p>The ground truth image is the same image but without aliasing.</p>

<p>There are many ways to make an alias-free image, but a straight forward way would be by doing super sampling.</p>

<p><strong>Super Sampling</strong></p>

<p>When we render, we usually take a single sample at the center of the pixel (rasterize / shader / etc it to make the color).</p>

<p>Super sampling works by taking $N$ samples for that pixel, in random parts of the pixel and averaging the result.</p>

<p>The more samples you take, the closer you get to the ideal "alias free" image.</p>

<p>One simple way to do super sampling is to render the image at a higher resolution and then shrink it down to a smaller image.  For instance, if you render at double the height and width and then shrink the image down, that's the same as taking 4 samples per pixel.  However, going this route, the samples are evenly spaced on a grid, not randomly placed within each pixel.  Making the samples random instead of evenly spaced is really important to this monte carlo integration working, but evenly spacing them on a grid is a cheaper method that is better than nothing (aka useful in realtime situations sometimes).</p>

<p>Another way to do super sampling would be to render the image at normal resolution $N$ times, but in each render, you randomly offset the camera by a sub-pixel amount.  You then average your $N$ images together.  That will give you the random sample points, but of course each pixel has the same random sample points.</p>

<p>This is why you will often see sub-pixel jittering of the camera when doing temporal anti aliasing: it allows for better anti aliased results (a better integration) over time when combining multiple frames.  If they were all in the same position every frame, you wouldn't get any more information about the pixel.</p>

<p>Doing these methods will give you your ground truth alias free image, if using enough samples.</p>

<p><strong>Comparing vs Ground Truth</strong></p>

<p>The next step would be to compare the other anti aliased techniques against the super sampled ground truth.</p>

<p>There are lots and lots of ways that you might want to analyze this data, but I'll give a few ideas.</p>

<p>One way could be to make a texture where each pixel is the absolute value of the difference between the images for that pixel.  This would let you see the entire image as a whole and get an idea of how different it was from the ground truth.</p>

<p>Another way could be to calculate the mean and standard deviation of the difference of the images. This would give you an idea of how much on average pixels differed in the images, while also giving you an idea of how much variance there was in the difference. A high variance means some places are much worse than other places, so isn't very consistent.  Ideally, the best AA method will have the lowest mean, and the lowest variance.</p>

<p>Lastly, since aliasing is ultimately a "frequency" thing, you might find interesting data in doing a discrete Fourier transform on your images and comparing the frequencies in the AA method images vs the frequencies in the super sampled image.</p>

<p>More info on taking DFT of images here: <a href="https://blog.demofox.org/2016/07/28/fourier-transform-and-inverse-of-images/" rel="nofollow noreferrer">https://blog.demofox.org/2016/07/28/fourier-transform-and-inverse-of-images/</a></p>

CC BY-SA 3.0
2017-09-27T08:45:25.103Z
Unfortunately in my case, there is no ground truth image available. We cannot get these images due to some issues related to Field of View of the images. 
**Is there any other way we can use the results and do the comparisons against each other ?**
Varun Vijaykumar
CC BY-SA 3.0
2017-09-27T09:33:39.870Z
WRT to generating the Ground Truth, make sure you don't down sample with a box filter. You could to 10k samples per pixel and still have aliasing.
Simon F
CC BY-SA 3.0
2017-09-27T14:51:14.017Z
There may be some way but I don't know of one. The problem with aliasing is that information is lost, which is hard to detect after the fact.
Alan Wolfe
CC BY-SA 3.0
2017-09-27T18:05:07.690Z
I'm surprised you can't get a ground truth due to a field of view setting.  Can you excplain?  Anyways, another idea that may or may not work out is to use the image you have as a super sampled ground truth image: shrink it down to like 1/4 size or smaller using good filtering to minimize aliasing.  Next, take the source image and shrink it down to the same size using bad filtering that causes aliasing. next use your AA techniques and compare them against the ground truth you have.  Another option that may work is to use a different image to test AA on, one you can get a ground truth for.
Alan Wolfe
CC BY-SA 3.0
2017-09-26T17:54:25.353Z
2017-09-26T17:54:25.353Z
Alan Wolfe
<p>I am trying out different anti-aliasing algorithms on my image to improve the image quality. I want to compare the differences between these generated images via some metric. I was checking online for good metrics and found none.</p>

<p>Could someone please help me by pointing me to a valid metric that one can use to measure aliasing effects in an image ? </p>

<antialiasing>
How to compare anti-aliasing effects on images ?
Varun Vijaykumar
# How to compare anti-aliasing effects on images ?

(Asked by: username_0 on 2017-09-26)

I am trying out different anti-aliasing algorithms on my image to improve the image quality. I want to compare the differences between these generated images via some metric. I was checking online for good metrics and found none.

Could someone please help me by pointing me to a valid metric that one can use to measure aliasing effects in an image ?

**Tags:** antialiasing


---

## 1 answers

### Answer by username_1 on 2017-09-26. Score: 1

What you want to do is compare your anti aliased results against a "ground truth" image.

The ground truth image is the same image but without aliasing.

There are many ways to make an alias-free image, but a straight forward way would be by doing super sampling.

**Super Sampling**

When we render, we usually take a single sample at the center of the pixel (rasterize / shader / etc it to make the color).

Super sampling works by taking $N$ samples for that pixel, in random parts of the pixel and averaging the result.

The more samples you take, the closer you get to the ideal "alias free" image.

One simple way to do super sampling is to render the image at a higher resolution and then shrink it down to a smaller image. For instance, if you render at double the height and width and then shrink the image down, that's the same as taking 4 samples per pixel. However, going this route, the samples are evenly spaced on a grid, not randomly placed within each pixel. Making the samples random instead of evenly spaced is really important to this monte carlo integration working, but evenly spacing them on a grid is a cheaper method that is better than nothing (aka useful in realtime situations sometimes).

Another way to do super sampling would be to render the image at normal resolution $N$ times, but in each render, you randomly offset the camera by a sub-pixel amount. You then average your $N$ images together. That will give you the random sample points, but of course each pixel has the same random sample points.

This is why you will often see sub-pixel jittering of the camera when doing temporal anti aliasing: it allows for better anti aliased results (a better integration) over time when combining multiple frames. If they were all in the same position every frame, you wouldn't get any more information about the pixel.

Doing these methods will give you your ground truth alias free image, if using enough samples.

**Comparing vs Ground Truth**

The next step would be to compare the other anti aliased techniques against the super sampled ground truth.

There are lots and lots of ways that you might want to analyze this data, but I'll give a few ideas.

One way could be to make a texture where each pixel is the absolute value of the difference between the images for that pixel. This would let you see the entire image as a whole and get an idea of how different it was from the ground truth.

Another way could be to calculate the mean and standard deviation of the difference of the images. This would give you an idea of how much on average pixels differed in the images, while also giving you an idea of how much variance there was in the difference. A high variance means some places are much worse than other places, so isn't very consistent. Ideally, the best AA method will have the lowest mean, and the lowest variance.

Lastly, since aliasing is ultimately a "frequency" thing, you might find interesting data in doing a discrete Fourier transform on your images and comparing the frequencies in the AA method images vs the frequencies in the super sampled image.

More info on taking DFT of images here: <https://blog.demofox.org/2016/07/28/fourier-transform-and-inverse-of-images/>

> **Comments:**
> **username_0**: Unfortunately in my case, there is no ground truth image available. We cannot get these images due to some issues related to Field of View of the images.  **Is there any other way we can use the results and do the comparisons against each other ?**  
> **username_2**: WRT to generating the Ground Truth, make sure you don't down sample with a box filter. You could to 10k samples per pixel and still have aliasing.  
> **username_1**: There may be some way but I don't know of one. The problem with aliasing is that information is lost, which is hard to detect after the fact.  
> **username_1**: I'm surprised you can't get a ground truth due to a field of view setting.  Can you excplain?  Anyways, another idea that may or may not work out is to use the image you have as a super sampled ground truth image: shrink it down to like 1/4 size or smaller using good filtering to minimize aliasing.  Next, take the source image and shrink it down to the same size using bad filtering that causes aliasing. next use your AA techniques and compare them against the ground truth you have.  Another option that may work is to use a different image to test AA on, one you can get a ground truth for.  

---

