# Visualize the variance of an image

Let $$h_j$$ denote the image reconstruction filter of pixel $$j$$. I'm estimating the color value $$I_j=\int h_jf\:{\rm d}\mu$$ of the $$j$$th pixel (see [Veach, Section 8.2]) by an asymptotically consistent estimator whose asymptotic variance is given by $$\sigma^2_j$$. (This has to be understood in a component-wise sense, i.e. $$\sigma_j^2$$ is a 3-dimensional vector whose $$i$$th component is the asymptotic variance of the estimate of the $$i$$th component of $$I_j$$.

Question 1: I want to compare different estimators which lead to different asymptotic variances and would like to visualize that one is superior to another (with respect to variance reduction). How can I do that? Simply writing the variances into an image doesn't seem to be sensible. (The problem is the scale of the values.)

Question 2: For simplicity, assume a box filter with radius $$\frac12$$ so that the computation of $$I_j$$ only involves the $$j$$th pixel. Instead of considering the variances of each pixel, I've seen that we could consider the variances of a "local window" (for example a $$3\times 3$$ pixel window). Is this a better or worse metric for the total variance of the image?

• The variance is computed per pixel - you are estimating a different integral in each pixel. It is reasonable to have a different variance for different pixels. – lightxbulb Apr 4 '20 at 9:10
• Pick one pixel and use one estimator, then compute the variance at different sample counts, store the sample counts and the corresponding variance at each in a text file. Do the same for a different estimator. Make a plot of sample count vs variance for both (you can use matplotlib in Python or Matlab). This way you'll be able to compare the asymptotic behaviour of the two for the integrand at the chosen pixel. You can use a log-log scale if the difference warrants it. It's a common way of comparing low discrepancy vs random sequence performance. – lightxbulb Apr 4 '20 at 10:56
• Try visualizing the variance through a program like tev: github.com/Tom94/tev As for "overall" variance, I am not aware of a specific metric. The simplest thing you could do is take the average, but obviously you lose some information this way - it's perfectly reasonable that one estimator is better in one part of the image, while the other is better in another part. What's the purpose of this exercise? – lightxbulb Apr 4 '20 at 17:44
• @0xbadf00d typically one would compute a reference image with several thousand samples and look at an averaged, pixel-wise comparison with your algorithm as a function of time. Popular metrics are sMAPE and relMSE but other perceptual metrics also exist. If you plot the error over time (log-log) you can then track how fast your new estimator can reduce the variance compared to a baseline. See Figure 5 of this paper for an example in MCMC. – Hubble Apr 4 '20 at 17:48
• This CGF paper from 2019 might give you some insights on what you are trying to accomplish. – Hubble Apr 4 '20 at 17:52