degate  0.1.2
Static Public Member Functions
degate::CalculateImageMedianPolicy< ImageType, PixelType > Struct Template Reference

Policy class for image region median calculation. More...

#include <MedianFilter.h>

List of all members.

Static Public Member Functions

static PixelType calculate (std::shared_ptr< ImageType > src, unsigned int x, unsigned int y, unsigned int min_x, unsigned int max_x, unsigned int min_y, unsigned int max_y, unsigned int threshold)
 Calculate the median for an image region.

Detailed Description

template<typename ImageType, typename PixelType>
struct degate::CalculateImageMedianPolicy< ImageType, PixelType >

Policy class for image region median calculation.

Definition at line 31 of file MedianFilter.h.

Member Function Documentation

template<typename ImageType , typename PixelType >
static PixelType degate::CalculateImageMedianPolicy< ImageType, PixelType >::calculate ( std::shared_ptr< ImageType >  src,
unsigned int  x,
unsigned int  y,
unsigned int  min_x,
unsigned int  max_x,
unsigned int  min_y,
unsigned int  max_y,
unsigned int  threshold 
) [inline, static]

Calculate the median for an image region.

Definition at line 36 of file MedianFilter.h.


      assert(min_x < max_x && min_y < max_y);
      assert(min_x < src->get_width());
      assert(max_x < src->get_width());
      assert(min_y < src->get_height());
      assert(max_y < src->get_height());

      unsigned int kernel_size = (max_x - min_x) * (max_y - min_y);
      std::vector<PixelType> v(kernel_size);

      unsigned int i = 0;
      for(unsigned int _y = min_y; _y < max_y; _y++)
        for(unsigned int _x = min_x; _x < max_x; _x++, i++)
          v[i] = src->get_pixel(_x, _y);

      return median<PixelType>(v);

The documentation for this struct was generated from the following file: