# Block Guide: Focal Analysis Block

Modified on Thu, 20 Jul 2023 at 11:18 AM

Focal Analysis refers to the process whereby a pixel is assigned a new value based on the properties of neighbouring pixels.  The "window" that decides which of the neighbouring pixels are included in the calculation is called the kernel.  This kernel is applied to every pixel within the image. In this article, we describe each of the options within the Focal Analysis block.

# Block Guide: Focal Analysis Block

## How to Use the Focal Analysis Block

• The Focal Analysis block is available within the Calculator toolbox.
• It looks like this: • There are three options in the dropdown menu:
• Smooth my image (the default): This reduces sharp features and visually blurs the image.
• Detect edges in my image: This identifies the changes in brightness associated with edges within an image.
• Calculate focal statistics: This calculates various statistical properties of the pixels within the kernel.
• Each of these options is described in more detail below.

## Smoothing an image

• One of the most common applications of this block is to smooth an image.
• Times when this might be appropriate include:
• Reducing the speckle effect in a radar image (such as Sentinel 1).
• Taking area averages of discrete occurrences, such as fires.
• Removing texture features within a dataset.
• The options look like this. • You can select as many bands as you would like to be smoothed.
• Each output band is given an additional suffix to its name to indicate that it has been smoothed. The default is "_smooth" but you can give it another name if appropriate.  The original bands are still available to use in other blocks.
• The kernel is the type of shape that is being used to collect the data from the surrounding pixels.
• The choice of kernel for smoothing is:
• Square (recommended when you want to stick closely to the grid of pixels)
• Circle
• Euclidean
• Manhattan
• Gaussian (recommended for generating indicator maps, like heat maps. Also known as Gaussian blur)
• Chebyshev
• For example, if you choose a square kernel you will get the following options: • The radius determines the size of the kernel.
• You can choose to measure the size in pixels or in physical dimensions.
• Note that if you choose pixels as your dimension, it will use the pixel size of the displayed map layer, not the pixel size of the original data.
• The check box for normalising will weight each pixel within the kernel so that the result is equal to the specified magnitude. The default is 1.
• Here is an example of what a Gaussian smoothing filter of 20 m radius does to an S1 image:

## Edge detection

• This process identifies where the values of pixels change rapidly, and in a spatially consistent way, on the assumption that this implies some feature edge in the area.
• Times when this might be appropriate include:
• Trying to identify linear features in data (roads, rivers, etc).
• Identifying the edge of geographic features such as lakes or coastlines.
• Finding the edge of agricultural fields.
• Note that the result is a raster image, not a vector.
• The choices available are similar to those outlined above for smoothing.
• Here is an example using the Kirsch filter on Sentinel 2 NIR band. The first image is the NIR image and the second image is the edge detection output.  ## Focal Statistics

• This option is a more general form of Smoothing.
• While Smoothing using the mean of the values within the kernel, with the Focal Statistics option you can choose other metrics such as median, mode, max, min, etc.
• The other choices work the same way as described in the section about Smoothing above.

We always track the feedback you give us so that we can improve how we help you. 