The filter2 X-Function applies a square filter matrix to a source matrix. The filter matrix is centered over each cell of the source matrix.
For user-interface access to this function:
Controls recalculation of analysis results
For more information, see: Recalculating Analysis Results
The input matrix object.
For help with range controls, see: Specifying Your Input Data
The filter matrix object.
The filter matrix may lie outside the source matrix at the edges. Choose a padding method (see Algorithm, below).
If selected, normalize replacement value with weight of filter.
The output matrix object.
For help with the range controls, see: Output Results
This function takes an by filter matrix and places it centered over each cell of the source matrix. For each cell in the filter, the function computes the product of the filter element with the overlaid cell of the original matrix, sums all of the products, normalizes to the weight of the filter (if selected), and then replaces the pixel in the original image with the recalculated value.
The value of cell(2,2) in the output matrix is:
If the Normalize check box is selected, the overlaid cells' products will be normalized by the weight of the corresponding cell of the filter.
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).