replace memcpy by duplicate
replace .C interface by .Call: dilation/erosion