User guide

Table Of Contents
January 2013 Altera Corporation Video and Image Processing Suite
User Guide
5. 2D Median Filter MegaCore Function
Core Overview
The 2D Median Filter MegaCore function applies 3×3 or 5×5 pixel median filters to
video images. Median filtering removes speckle noise and salt-and-pepper noise
while preserving the sharpness of edges in video images.
Functional Description
The 2D Median Filter MegaCore function provides a means to perform 2D median
filtering operations using matrices of 3×3 or 5×5 kernels.
Each output pixel is the median of the input pixels found in a 3x3, 5x5, or 7×7 kernel
centered on the corresponding input pixel. Where this kernel runs over the edge of the
input image, zeros are filled in.
Larger kernel sizes require many more comparisons to perform the median filtering
function and therefore require correspondingly large increases in the number of logic
elements. Larger sizes have a stronger effect, removing more noise but also potentially
removing more detail.
1 All input data samples must be in unsigned format. If the number of bits per pixel per
color plane is N, this means that each sample consists of N bits of data which are
interpreted as an unsigned binary number in the range [0, 2
N
– 1]. All output data
samples produced by the 2D Median Filter MegaCore function are also in the same
unsigned format.
Avalon-ST Video Protocol Parameters
The 2D Median Filter MegaCore function can process streams of pixel data of the
types listed in Table 51.
Stall Behavior and Error Recovery
The 2D Median Filter MegaCore function has a delay of a little more than N–1 lines
between data input and output in the case of a N×N 2D Median Filter. This is due to
line buffering internal to the MegaCore function.
Table 5–1. 2D Median Filter Avalon-ST Video Protocol Parameters
Parameter Value
Frame Width As selected in the parameter editor.
Frame Height As selected in the parameter editor.
Interlaced / Progressive Progressive.
Bits per Color Sample Number of bits per color sample selected in the parameter editor.
Color Pattern
One, two or three channels in sequence. For example, if three channels in
sequence is selected where ,  and can be any color plane:
γβα