Partial derivatives dx and dy for 2D images. (code found on: http://image-processing-is-fun.blogspot.fr/2011/11/taking-partial-derivatives-is-easy-in.html)