24 #include <core/exception.h> 26 #include <fvfilters/morphology/geodesic_erosion.h> 27 #include <fvfilters/morphology/segenerator.h> 28 #include <fvfilters/morphology/erosion.h> 29 #include <fvfilters/max.h> 31 #include <fvutils/color/colorspaces.h> 32 #include <fvutils/statistical/imagediff.h> 48 fawkes::Exception e("FilterGeodesicErosion failed"); \ 49 e.append("Function: %s", __FUNCTION__); \ 50 e.append("Message: %s", m); \ 65 this->se_size = (se_size > 0) ? se_size : 1;
91 if (
dst == NULL ) ERROR(
"dst == NULL");
92 if (
src[
MASK] == NULL ) ERROR(
"src[MASK] == NULL");
93 if (
src[
MARKER] == NULL ) ERROR(
"src[MARKER] == NULL");
96 unsigned char *tmp = (
unsigned char *)malloc(colorspace_buffer_size(YUV422_PLANAR,
src_roi[MARKER]->image_width,
src_roi[MARKER]->image_height) );
97 memcpy( tmp,
src[MARKER], colorspace_buffer_size(YUV422_PLANAR,
src_roi[MARKER]->image_width,
src_roi[MARKER]->image_height) );
114 }
while (diff->
different() && ( ++iterations < 255) );
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.
virtual unsigned int num_iterations()
Get the number of iterations.
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.
void setBufferA(unsigned char *yuv422planar_buffer, unsigned int width, unsigned int height)
Set first buffer.
virtual void apply()
Apply the filter.
bool different()
Check if images are different.
virtual void apply()
Apply the filter.
virtual void apply()
Apply the filter.
unsigned int image_width
width of image that contains this ROI
Image difference checker.
static unsigned char * square(unsigned int width, unsigned int height)
Generate square structuring element.
Morphological filter interface.
unsigned char ** src
Source buffers, dynamically allocated by Filter ctor.
unsigned int image_height
height of image that contains this ROI
static const unsigned int MARKER
Marker.
ROI ** src_roi
Source ROIs, dynamically allocated by Filter ctor.
FilterGeodesicErosion(unsigned int se_size=3)
Constructor.
virtual ~FilterGeodesicErosion()
Destructor.
void setBufferB(unsigned char *yuv422planar_buffer, unsigned int width, unsigned int height)
Set second buffer.
static const unsigned int MASK
Mask.
unsigned char * dst
Destination buffer.
ROI * dst_roi
Destination ROI.
virtual void set_dst_buffer(unsigned char *buf, ROI *roi)
Set the destination buffer.