The direction detection algorithm is based on the use of a set of two-dimensional (2-D) correlation kernels. The most intuitive understanding of 2D cross correlation is a measure of similarity of two patterns. A template mimicking nerves running in a certain direction will be put near the point of interest, and cross correlation between the template and the adjacent region of image will be calculated. If the point of interest is on a nerve and the nerve is running to the same direction, it will lead to a large cross correlation respond.
We decided to study the direction based on 16 discretized directions, separated by 22.5 degrees. There are 16 templates corresponding to these 16 directions. Four of them were shown below, in respect of the location of its point of interest, and rotating these templates counterclockwise by 90, 180, 270 degrees can produce the other 12 templates. As a result, for a certain point in the image, there will be 16 cross correlation respond, each associated with one direction, and the greatest respond corresponds to the most likely direction.
A sample image were input to the direction detection algorithm. The resulted 16 maps of cross correlation were produced and shown. As we can see, points on a line closer to a certain direction will have greater value on the map which corresponds to this direction.