This class implements a basic median filter for images. More...
#include <MedianFilter.h>
Public Member Functions | |
virtual void | apply (const T &iImg, T &oImg) |
int | getWindowHeight () const |
int | getWindowWidth () const |
MedianFilter (int windowWidth, int windowHeight) | |
MedianFilter (int windowSize) | |
virtual | ~MedianFilter () |
Private Member Functions | |
void | computeHelpers () |
Private Attributes | |
int | mHalfWindowHeight |
int | mHalfWindowWidth |
int | mMedianIndex |
int | mNumWindowElements |
T::ElementType * | mWindowElements |
int | mWindowHeight |
int | mWindowWidth |
This class implements a basic median filter for images.
This class implements a basic median filter for single channel images. If it is used for multi-channel images, it will be applied per channel and a warning will be produced. The median filter will only be applied to image elements where the filter window fits completely into the image, i.e. if the window has width and height of five, the first and the last two rows and colums will not be filtered.
Definition at line 25 of file MedianFilter.h.
puma2::MedianFilter< T >::MedianFilter | ( | int | windowWidth, |
int | windowHeight | ||
) |
Constructor. Sets width and height of the median filter window.
windowWidth | Width of the window of the median filter |
windowHeight | Height of the window of the median filter |
Definition at line 126 of file MedianFilter.h.
puma2::MedianFilter< T >::MedianFilter | ( | int | windowSize | ) |
Constructor for sqare windows. Sets height and width of the median filter window to windowSize.
windowSize | Size of the median filter window (width and height) |
Definition at line 109 of file MedianFilter.h.
puma2::MedianFilter< T >::~MedianFilter | ( | ) | [virtual] |
Destructor deletes dynamically allocated memory.
Definition at line 155 of file MedianFilter.h.
void puma2::MedianFilter< T >::apply | ( | const T & | iImg, |
T & | oImg | ||
) | [virtual] |
Do the real work of the operator
Implements puma2::ImageToImageOperator< T, T >.
Definition at line 167 of file MedianFilter.h.
void puma2::MedianFilter< T >::computeHelpers | ( | ) | [private] |
Computes the helpers for the apply() function. This function is called in the constructors. The members mHalfWindowWidth, mHalfWindowHeight, mNumWindowElements and mMedianIndex will be computed and the memory for mWindowElements will be allocated.
Definition at line 146 of file MedianFilter.h.
int puma2::MedianFilter< T >::getWindowHeight | ( | ) | const [inline] |
Definition at line 60 of file MedianFilter.h.
int puma2::MedianFilter< T >::getWindowWidth | ( | ) | const [inline] |
Definition at line 55 of file MedianFilter.h.
int puma2::MedianFilter< T >::mHalfWindowHeight [private] |
Stores (mWindowHeight - 1) / 2
Definition at line 89 of file MedianFilter.h.
int puma2::MedianFilter< T >::mHalfWindowWidth [private] |
Stores (mWindowWidth - 1) / 2
Definition at line 84 of file MedianFilter.h.
int puma2::MedianFilter< T >::mMedianIndex [private] |
Stores the index of the median in mWindowElements (mNumWindowElements / 2)
Definition at line 104 of file MedianFilter.h.
int puma2::MedianFilter< T >::mNumWindowElements [private] |
Stores the number of elements in the window (mWindowHeight * mWindowWidth).
Definition at line 94 of file MedianFilter.h.
T::ElementType* puma2::MedianFilter< T >::mWindowElements [private] |
Stores the window elements.
Definition at line 99 of file MedianFilter.h.
int puma2::MedianFilter< T >::mWindowHeight [private] |
Stores the height of the filter window
Definition at line 79 of file MedianFilter.h.
int puma2::MedianFilter< T >::mWindowWidth [private] |
Stores the width of the filter window
Definition at line 74 of file MedianFilter.h.