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

Policy class for image erosion. More...

#include <MorphologicalFilter.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 erosion_threshold)

Detailed Description

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

Policy class for image erosion.

This policy class can be used for any single channel image. Pixel values evaluate to 0 if they are <= 0 and evaluated to 1 if they are > 0.

Definition at line 33 of file MorphologicalFilter.h.

Member Function Documentation

template<typename ImageType , typename PixelType >
static PixelType degate::ErodeImagePolicy< 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  erosion_threshold 
) [inline, static]

Definition at line 35 of file MorphologicalFilter.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 i = 0;

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

      return i <= erosion_threshold ? 0 : src->get_pixel(x, y);

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