|
SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
|
#include <MedianFilter.h>
Public Member Functions | |
| MedianFilter (int box_width, int box_height) | |
| MedianFilter (const std::array< int, 2 > &box) | |
| auto | operator() (const VectorImage< T > &image, const VectorImage< T > &variance, T threshold=0) const -> std::pair< std::shared_ptr< VectorImage< T > >, std::shared_ptr< VectorImage< T > > > |
Private Member Functions | |
| std::vector< T > | getBox (const VectorImage< T > &img, int x, int y) const |
Static Private Member Functions | |
| static T | getMedian (std::vector< T > &data) |
| static int | clip (int position, int box_size, int image_size) |
Private Attributes | |
| int | m_box_width |
| int | m_box_height |
Functor that applies a median filter over a pair of image/variance image
| T | Pixel type of the filtered image |
A median filter takes as parameters the width and height of the smoothing box. Each pixel is computed as the median of the values of the pixels contained within a box centered at its coordinates iff the median value differs from the actual value by more than a given threshold.
If the value of the pixel is replaced, the value of the variance at the same coordinates is replaced also by the median of the variances contained within the box.
There is no padding. At the edges whe box size is symmetrically clipped to the number of available pixels.
Definition at line 41 of file MedianFilter.h.
|
inline |
Constructor
| box_width | |
| box_height |
Definition at line 48 of file MedianFilter.h.
References m_box_height, and m_box_width.
Referenced by MedianFilter().
|
inlineexplicit |
Constructor
| box | A two dimensional array where the first value corresponds to the width, and the second to the height. |
Definition at line 56 of file MedianFilter.h.
References MedianFilter().

|
inlinestaticprivate |
Symmetrically clip the size of the smoothing box depending on the number of available pixels. This is a 1-D version that is applied to X and Y separately.
| position | Coordinate where the box will be centered |
| box_size | Size of the smoothing box |
| image_size | Image size |
Definition at line 127 of file MedianFilter.h.
Referenced by getBox().
|
inlineprivate |
Get the pixel values contained within a box centered at x,y
Definition at line 139 of file MedianFilter.h.
References std::back_inserter(), clip(), SourceXtractor::VectorImage< T >::getHeight(), SourceXtractor::VectorImage< T >::getValue(), SourceXtractor::VectorImage< T >::getWidth(), std::inserter(), m_box_height, and m_box_width.
Referenced by operator()().

|
inlinestaticprivate |
Convenience method to compute the median of a vector
| data | The vector on which to compute the median. It will be modified. |
Definition at line 107 of file MedianFilter.h.
References std::vector< T >::begin(), std::vector< T >::end(), std::vector< T >::size(), and std::sort().
Referenced by operator()().

|
inline |
Call operator
| image | Image to filter |
| variance | Associated variance map |
| threshold | The pixel is replaced only if the median and the actual value differ by at least this value. Defaults to 0 (always replaced). |
Definition at line 71 of file MedianFilter.h.
References SourceXtractor::VectorImage< T >::create(), getBox(), SourceXtractor::VectorImage< T >::getHeight(), getMedian(), SourceXtractor::VectorImage< T >::getValue(), SourceXtractor::VectorImage< T >::getWidth(), and std::make_pair().

|
private |
Definition at line 100 of file MedianFilter.h.
Referenced by getBox(), and MedianFilter().
|
private |
Definition at line 100 of file MedianFilter.h.
Referenced by getBox(), and MedianFilter().