Standard Deviation

In order to calculate the standard deviation for each pixel of the DSM SURE uses a user defined mask size. By default this mask is of size 3x3. For each pixel of the image, SURE calculates the population standard deviation of all pixels inside the mask in the specified coordinate systems unit and saves it as the value of the current pixel. For the difference between population and sample standard deviation please refer to this Wikipedia article.

Special cases

Even vs. odd mask size values

Since the standard deviation is calculated on a discrete grid of pixels, the mask size should always be an odd, positive number (3x3, 5x5, 7x7, ..). If the mask size is set to an even number, SURE is going to increment the mask size by one. A mask size value of 4 is therefore going to result in a 5x5 mask. We strongly advise users to use odd numbers as mask size to avoid any possible confusion.


Large mask size values

In order to calculate the standard deviation at the tile border of the DSM, SURE uses an extended DSM that is also used for interpolation. The size of this extension is set by $DsmTempApronSize in controlDsm.txt. This also means the biggest possible mask size that can be used for calculating the standard deviation is 2*$DsmTempApronSize. If users enter a mask size bigger than 2*$DsmTempApronSize, SURE is automatically going to use 2*$DsmTempApronSize as mask size for the whole image.


NaNs

The calculation of the standard deviation is based on the DSM before interpolation. At this stage the DSM still contains NaNs for every pixel that doesn't contain any measured values. In order to calculate a standard deviation, SURE will ignore all pixels containing NaNs. If none of the pixels inside the current mask contains measured values (i.e. all are NaNs), the result will be a NaN in the standard deviation image. If exactly one pixel inside the current mask contains a measured value the standard deviation is going to be positive infinity and only if two or more pixels inside the current mask contain a measured value SURE is going to compute the standard deviation.

Example

Here is - from left to right - an example of a DSM and the respective standard deviation image. The standard deviation was calculated with a mask size of 3x3 and both 32bit float images were individually scaled and converted in a way that makes them easy to view here: