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>
37 namespace firevision {
43 const unsigned int FilterGeodesicErosion::MARKER = 0;
45 const unsigned int FilterGeodesicErosion::MASK = 1;
48 fawkes::Exception e("FilterGeodesicErosion failed"); \
49 e.append("Function: %s", __FUNCTION__); \
50 e.append("Message: %s", m); \
62 FilterGeodesicErosion::FilterGeodesicErosion(
unsigned int se_size)
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) );