I want to find ridges for a given image. (Ridges not edges!)
An example is like the image below
I think Hessian matrix will work intuitively. So I hard coded Hessian matrix kernel by starting from a 2D-Gaussian equation as the links below described. How to build 2D hessian matrix kernel
I use surf
to visualize the 3 second order derivative kernels (D_xx,D_yy and D_xy) I created and they look all correct.
I then applied these kernels and did 2D convolution with my image.
I am not sure what to do next, should I need to represent eigen values and vectors by using D_xx,D_yy and D_xy? How can we pull out ridge lines from the image by using the eigen analysis of 2-by-2 matrix for each pixel? Any idea, formula or even code will be much helpful.
Attached is the code to generate 2D Hessian matrix
[x y]=meshgrid(round(-N/2):round(N/2), round(-N/2):round(N/2));
common = x.^2+y.^2;
Lxx = ((-1+x.^2/(sigma^2)).*exp(-common/(2*sigma^2))) / (2*pi*sigma^4);
Lxx = Lxx./ sum(Lxx(:));
Lyy = ((-1+y.^2/(sigma^2)).*exp(-common/(2*sigma^2))) / (2*pi*sigma^4);
Lyy = Lyy./ sum(Lyy(:));
Lxy = ((x.*y)/(2*pi*sigma^6)).*exp(-common/(2*sigma^2));
Lxy = Lxy./ sum(Lxy(:));