# 16.17 Special Filter

## Description

The specialflt2 X-Function applies a predefined filter to an input matrix. Predefined filters are:

• Average
• Horizontal Prewitt
• Vertical Prewitt
• Horizontal Sobel
• Vertical Sobel

For user-interface access to this function:

1. Create a new matrix with input data.
2. Activate the matrix.
3. Select Analysis: Mathematics: Special Filter. This opens the specialflt2 dialog box.

## Dialog Options

Input Matrix The input Matrix. The output matrix. Filter to be applied. Average filter Horizontal Prewitt filter Vertical Prewitt filter Horizontal Sobel filter Vertical Sobel filter How to pad cells outside matrix borders. ZeroPadding Pads with zeros. MapPadding Use reflection padding. RepeatPadding Repeat edge values.

## Algorithm

Supplied derivative filters:

Average filter:

$\begin{bmatrix} 1 & 1 & 1 \\1 & 1 & 1\\1 & 1 & 1\end{bmatrix}$

Horizontal Prewitt filter:

$\begin{bmatrix}1 & 1 & 1 \\0 & 0 & 0 \\-1 & -1 & -1\end{bmatrix}$

Vertical Prewitt filter:

$\begin{bmatrix}1 & 0 & -1 \\1 & 0 & -1 \\1 & 0 & -1\end{bmatrix}$

Horizontal Sobel filter:

$\begin{bmatrix}1 & 2 & 1 \\0 & 0 & 0 \\-1 & -2 & -1\end{bmatrix}$

Vertical Sobel filter:

$\begin{bmatrix}1 & 0 & -1\\2 & 0 & -2\\ 1 & 0 &-1\end{bmatrix}$

When applying a filter to the edge of the source matrix, some part of the filter may lie outside the source matrix boundary. When this occurs, the user can opt to pad the area outside the source matrix with zeros (Zero Padding), by reflection padding (Map Padding), or repeating edge values (Repeat Padding).