Implemented dilation and erosion, refactored ApplyKernel a bit to be a bit more flexible since multiplication is not necessarily the desired action.