Added functions for morphological dilation and erosion