SourceXtractorPlusPlus
0.12
Please provide a description of the project.
|
#include <MedianFilter.h>
Public Member Functions | |
MedianFilter (int box_width, int box_height) | |
MedianFilter (const std::array< int, 2 > &box) | |
auto | operator() (const Image< T > &image, const Image< 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 Image< 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 40 of file MedianFilter.h.
|
inline |
|
inline |
Constructor
box | A two dimensional array where the first value corresponds to the width, and the second to the height. |
Definition at line 55 of file MedianFilter.h.
|
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 126 of file MedianFilter.h.
Referenced by SourceXtractor::MedianFilter< T >::getBox().
|
inlineprivate |
Get the pixel values contained within a box centered at x,y
Definition at line 138 of file MedianFilter.h.
References std::back_inserter(), SourceXtractor::MedianFilter< T >::clip(), SourceXtractor::Image< T >::getHeight(), SourceXtractor::Image< T >::getValue(), SourceXtractor::Image< T >::getWidth(), std::inserter(), SourceXtractor::MedianFilter< T >::m_box_height, SourceXtractor::MedianFilter< T >::m_box_width, x, and y.
Referenced by SourceXtractor::MedianFilter< T >::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 106 of file MedianFilter.h.
References std::vector< T >::begin(), std::vector< T >::end(), std::vector< T >::size(), and std::sort().
Referenced by SourceXtractor::MedianFilter< T >::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 70 of file MedianFilter.h.
References SourceXtractor::VectorImage< T >::create(), SourceXtractor::MedianFilter< T >::getBox(), SourceXtractor::Image< T >::getHeight(), SourceXtractor::MedianFilter< T >::getMedian(), SourceXtractor::Image< T >::getValue(), SourceXtractor::Image< T >::getWidth(), std::make_pair(), SourceXtractor::VectorImage< T >::setValue(), x, and y.
|
private |
Definition at line 99 of file MedianFilter.h.
Referenced by SourceXtractor::MedianFilter< T >::getBox().
|
private |
Definition at line 99 of file MedianFilter.h.
Referenced by SourceXtractor::MedianFilter< T >::getBox().