Second order directional derivative in image processing

it is all about valley detection in image processing. I would like to find, for a given pixel, direction for higher second order derivative. I am not quite sure what discrete mask/filter I can use to compute directional derivative, along xx, yx, xy, yy. What should I understand with 'direction of higher second order derivative'? is it one of the four xx, yx, xy, yy with maximum filter value? In the end, I am to found loci of extremal height for the signal, in direction along which second order derivative is of greatest magnitude. How to do so? Could you hint at relevant doc?

• Direction for second-order derivative? Sep 7 '12 at 19:08
• Lxx is derivative along direction xx, Lxy along diagonal xy etc... Sep 7 '12 at 19:18
• I'm not sure to understand your question, but I suspect you are looking for eigenvalues and eigenvectors of the Hessian matrix. Sep 7 '12 at 22:14

You are looking for the directions of the eigenvectors of the Hessian matrix (i.e., the matrix of second derivatives) that correspond to the largest and smallest eigenvalues. At a local minimum, any function can be developed into a Taylor series $$f(x) \approx f(x_0) + \frac 12 (x-x_0)^T H (x-x_0) = m_2(x)$$ where $H=\nabla^2 f(x_0)$ and where $m_2(x)$ is this local approximation. The directions where $m_2$ curves up the quickest are the directions that correspond to the eigenvectors of the largest eigenvalue of $H$. The directions where $m_2$ grows the slowest (the "valley floor") correspond to the direction of the eigenvector with the smallest eigenvalue of $H$.
• This should be a standard question for image processing books. For example, you should be able to get $L_{xx}$ as (right neighbor pixel - 2*this pixel + left neighbor pixel) and similar for the other pixels. Sep 8 '12 at 11:51
• : ) yes, sounds good. thanks. would you agree on my method: compute determinant, compute trace, find $\lambda_{1},\lambda_{2}$ and associated eigenvectors (how to do that quickly?), and keep direction of smallest eigenvector, as you mentionned? Sep 8 '12 at 11:59