How do I compute the gradient vector of pixels in an image? I'm trying to find the curvature of the features in an image and I was advised to calculate the gradient vector of pixels. So if the matrix below are the values from a grayscale image, how would I go about calculating the gradient vector for the pixel with the value '99'?

21 20 22 24 18 11 23
21 20 22 24 18 11 23
21 20 22 24 18 11 23
21 20 22 99 18 11 23
21 20 22 24 18 11 23
21 20 22 24 18 11 23
21 20 22 24 18 11 23


Apologies for asking such an open ended question, I've never done much maths and am not sure how to start tackling this.
So, if you're using Matlab, you can do:

X = your matrix

[gx,gy] = gradient(X); % first order gradient

[gxx,gxy] = gradient(gx); % second order gradient

[gxy,gyy] = gradient(gy); % second order gradient


To find the curvature of features I advise you to look into the eigenvalues and eigenvectors of a Hessian matrix. A hessian matrix is a square matrix of second-order derivatives of a scalar valued function. In this case the scalar field is the intensity, and the second order derivatives are $g_{xx}$, $g_{xy}$, $g_{yy}$.