Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to do erosion on a 3D image?

I have a 2d image Mat matr, and I do an erosion as follows:

 Mat erosion_dst;
 // Apply the erosion operation
 int erosion_type;
 int errosion_size = 0;
 erosion_type = MORPH_ELLIPSE;
 Mat element = getStructuringElement( erosion_type,
                                      Size( 2*erosion_size + 1, 2*erosion_size+1 ),
                                      Point( erosion_size, erosion_size ) );
 erode(matr, erosion_dst, element);

How can I do the same thing but for a 3D image? How would the code change?