How do I compute the gradient vector of pixels in an image?
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}$.