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

Policy class for image region median calculation for RGB(A) images. More...

#include <MedianFilter.h>

List of all members.

Static Public Member Functions

static rgba_pixel_t 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 RGBA image region.

Detailed Description

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

Policy class for image region median calculation for RGB(A) images.

Definition at line 68 of file MedianFilter.h.

Member Function Documentation

template<typename ImageType >
static rgba_pixel_t degate::CalculateImageMedianPolicy< ImageType, rgba_pixel_t >::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 RGBA image region.

Definition at line 74 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<unsigned int>

      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++) {

          rgba_pixel_t p = src->get_pixel(_x, _y);
          v_r[i] = MASK_R(p);
          v_g[i] = MASK_G(p);
          v_b[i] = MASK_B(p);
      return MERGE_CHANNELS(median<unsigned int>(v_r),
                            median<unsigned int>(v_g),
                            median<unsigned int>(v_b), 255);

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