Image gradient in the point

gradient, image-segmentation, math, point, vector

Solution

The gradient at each pixel of an image `I(x, y)` is simply the 2D vector `(dI/dx,dI/dy)(x, y)`. Approximate `dI/dx` and `dI/dy` with centered finite difference:

dI/dx(x, y) = (I(x + 1, y) - I(x - 1, y)) / 2 = (I(x + 1, y) - I(x, y) + I(x, y) - I(x - 1, y)) / 2
dI/dy(x, y) = (I(x, y + 1) - I(x, y - 1)) / 2 = (I(x, y + 1) - I(x, y) + I(x, y) - I(x, y - 1)) / 2

Problem

I'm working with the image segmentation. I need to compute image gradient in the point, so I was trying to understand by myself (because I know how to calculate gradient when having an ordinary equation) but I failed. I was googling... and googling but to find wright answer I couldn't. Can anyone say or give some information how to compute image gradient in the point step by step?

Original source