I am trying to find determinant of hessian matrix of a 50x50 grayscale image. Determinant of matrix I am getting is a very small value i.e 4.7612e-134. I think I am missing something. My code is below. Thanks
% computing second derivatives in each direction first
[gx, gy] = gradient(double(sliceOfImageK2));
[gxx, gxy] = gradient(gx);
[gyx, gyy] = gradient(gy);
hessianMatrix = [gxx gxy; gxy gyy];
determinantHessianMatrix = det(hessianMatrix)
I don't think you should assemble a
100x100matrix if you want to call it Hessian. Assemble instead a2x2matrix per each of the50x50(2500) pixels where you are sampling your derivatives.These are the 2500 hessians, expressed in a
2500x4matrix:Here expressed as 2500
2x2matrices:And these are the determinants of each
2x2matrix:Here as a
50x50matrix with the determinant of the Hessian at each pixel, if that is what you are after: