24 #include <core/exception.h>
25 #include <fvfilters/max.h>
26 #include <fvfilters/morphology/erosion.h>
27 #include <fvfilters/morphology/geodesic_erosion.h>
28 #include <fvfilters/morphology/segenerator.h>
29 #include <fvutils/color/colorspaces.h>
30 #include <fvutils/statistical/imagediff.h>
35 namespace firevision {
44 fawkes::Exception e("FilterGeodesicErosion failed"); \
45 e.append("Function: %s", __FUNCTION__); \
46 e.append("Message: %s", m); \
61 this->se_size = (se_size > 0) ? se_size : 1;
88 ERROR(
"src[MASK] == NULL");
90 ERROR(
"src[MARKER] == NULL");
92 ERROR(
"marker and mask ROI differ");
95 (
unsigned char *)malloc(colorspace_buffer_size(YUV422_PLANAR,
100 colorspace_buffer_size(YUV422_PLANAR,
120 }
while (diff->
different() && (++iterations < 255));
virtual void apply()
Apply the filter.
FilterGeodesicErosion(unsigned int se_size=3)
Constructor.
virtual unsigned int num_iterations()
Get the number of iterations.
virtual void apply()
Apply the filter.
static const unsigned int MARKER
Marker.
virtual ~FilterGeodesicErosion()
Destructor.
static const unsigned int MASK
Mask.
virtual void apply()
Apply the filter.
ROI ** src_roi
Source ROIs, dynamically allocated by Filter ctor.
virtual void set_dst_buffer(unsigned char *buf, ROI *roi)
Set the destination buffer.
unsigned char ** src
Source buffers, dynamically allocated by Filter ctor.
unsigned char * dst
Destination buffer.
ROI * dst_roi
Destination ROI.
virtual void set_src_buffer(unsigned char *buf, ROI *roi, orientation_t ori=ORI_HORIZONTAL, unsigned int buffer_num=0)
Set source buffer with orientation.
Image difference checker.
void setBufferA(unsigned char *yuv422planar_buffer, unsigned int width, unsigned int height)
Set first buffer.
void setBufferB(unsigned char *yuv422planar_buffer, unsigned int width, unsigned int height)
Set second buffer.
bool different()
Check if images are different.
Morphological filter interface.
virtual void set_structuring_element(unsigned char *se, unsigned int se_width, unsigned int se_height, unsigned int se_anchor_x, unsigned int se_anchor_y)
Set the structuring element for successive filter runs.
unsigned int image_width
width of image that contains this ROI
unsigned int image_height
height of image that contains this ROI
static unsigned char * square(unsigned int width, unsigned int height)
Generate square structuring element.