1

I want to build a Hessian matrix of a grayscale image but I need to calculate the second order derivatives. I'm working with BoofCV and I found out a function that calculates the first order:

ImageGradient_Gaussian<ImageUInt8,ImageFloat32> gaussian1 = new ImageGradient_Gaussian<ImageUInt8,ImageFloat32>(sigma, -1, ImageUInt8.class, ImageFloat32.class);
gaussian1.process(grayscaleImage, derivX, derivY);

I'm using as an input parameter "sigma" (standard deviation). Is there a function, or an other way, to calculate the second order derivatives using as input sigma and a grayscale image?

I'm open to other Java CV library suggestions.

Amir
  • 10,600
  • 9
  • 48
  • 75
Zerthimon
  • 435
  • 1
  • 9
  • 19

1 Answers1

1

You want to do something like:

GImageDerivativeOps.sobel(grey, derivX, derivY, BorderType.EXTENDED);
GImageDerivativeOps.hessianSobel(derivX, derivY, derivXX, derivXY, derivYY, BorderType.EXTENDED);

grey can be ImageFloat32 or ImageUInt8 deriv can be ImageFloat32 or ImageSInt16

The latest SNAPSHOT has an example, but it should work on older versions too:

https://github.com/lessthanoptimal/BoofCV/blob/master/examples/src/boofcv/examples/imageprocessing/ExampleImageDerivative.java

lessthanoptimal
  • 2,722
  • 2
  • 23
  • 25