Hi Georg
This code is for a median filter, but is quite the same thing for erosion.
void NoiseReduction( image_array ratio, pcl_bool issmall )
{
MedianFilter M;
BoxStructure sK(3);
BoxStructure lK(5);
MorphologicalTransformation MT(M,sK);
if (!issmall)
MT.SetStructure( lK );
for (int i = 0; i < ratio.Length(); i++)
MT >> ratio[i];
Console().Flush();
ProcessInterface::ProcessEvents();
}
You just have to change "MedianFilter M;" for "ErosionFilter M;" and you are ready to go. They are all defined in MorphologicalOperator.h. Also, look at the StructuringElement.h file for the predefined shapes.