determinant of hessian matrix of a greyscale image is too small

2 views (last 30 days)
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);
tayyab
  7 Comments
John D'Errico
John D'Errico on 23 Dec 2016
Are you applying the gradient to the image itself? Why would you do that? You have posted jpg images, but not sliceOfImageK2.

Sign in to comment.

Answers (2)

John D'Errico
John D'Errico on 22 Dec 2016
Nope. You are not missing a thing, well, except in your understanding of why you should not be using a determinant.
Determinants will almost always have numerical problems. So, when doing virtually any scientific computing task, you should almost never compute a determinant. There are always better ways to achieve what you need to do.
  6 Comments
Tayyab Ateeq
Tayyab Ateeq on 23 Dec 2016
Actually my objective is to detect particular black spots from brain mri. I have managed to extract all black spots in an image(which is nii file). Now I intend to apply SVM to classify right black dots from false positives. I have extracted all these black spots as patches and extracting features from them. I want to use determinant of hessian as a feature. Afterwards I also want to use eigen values and trace of hessian as features but I am stuck while computing determinant of hessian. I did not explain this before to avoid complexity.
Walter Roberson
Walter Roberson on 23 Dec 2016
"I want to use determinant of hessian as a feature"
Either "Don't DO that", or use a high precision calculation system.
Are you trying to determine critical points? https://en.wikipedia.org/wiki/Second_partial_derivative_test ? If so then notice that they are taking the hessian of a function, not the hessian of a matrix.

Sign in to comment.


FOROUGH ASKARISIAHOOIE
FOROUGH ASKARISIAHOOIE on 16 Dec 2017
Use the function "imgradientxyz" instead of "gradient", and use the latest version of Matlab.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!