how to estimate orientation and coherency of an anisotropic image by a gradient structure tensor
how to segment an anisotropic image with a single local orientation by a gradient structure tensor
Theory
Note
The explanation is based on the books [114], [19] and [250]. Good physical explanation of a gradient structure tensor is given in [274]. Also, you can refer to a wikipedia page Structure tensor.
A anisotropic image on this page is a real world image.
What is the gradient structure tensor?
In mathematics, the gradient structure tensor (also referred to as the second-moment matrix, the second order moment tensor, the inertia tensor, etc.) is a matrix derived from the gradient of a function. It summarizes the predominant directions of the gradient in a specified neighborhood of a point, and the degree to which those directions are coherent (coherency). The gradient structure tensor is widely used in image processing and computer vision for 2D/3D image segmentation, motion detection, adaptive filtration, local image features detection, etc.
Important features of anisotropic images include orientation and coherency of a local anisotropy. In this paper we will show how to estimate orientation and coherency, and how to segment an anisotropic image with a single local orientation by a gradient structure tensor.
The gradient structure tensor of an image is a 2x2 symmetric matrix. Eigenvectors of the gradient structure tensor indicate local orientation, whereas eigenvalues give coherency (a measure of anisotropism).
The gradient structure tensor J of an image Z can be written as:
where J_{11} = M[Z_{x}^{2}], J_{22} = M[Z_{y}^{2}], J_{12} = M[Z_{x}Z_{y}] - components of the tensor, M[] is a symbol of mathematical expectation (we can consider this operation as averaging in a window w), Z_{x} and Z_{y} are partial derivatives of an image Z with respect to x and y.
The eigenvalues of the tensor can be found in the below formula:
where \lambda_1 - largest eigenvalue, \lambda_2 - smallest eigenvalue.
How to estimate orientation and coherency of an anisotropic image by gradient structure tensor?
The orientation of an anisotropic image:
\alpha = 0.5arctg\frac{2J_{12}}{J_{22} - J_{11}}
Coherency:
C = \frac{\lambda_1 - \lambda_2}{\lambda_1 + \lambda_2}
The coherency ranges from 0 to 1. For ideal local orientation ( \lambda_2 = 0, \lambda_1 > 0) it is one, for an isotropic gray value structure ( \lambda_1 = \lambda_2 > 0) it is zero.
Source code
You can find source code in the samples/cpp/tutorial_code/ImgProc/anisotropic_image_segmentation/anisotropic_image_segmentation.cpp of the OpenCV source code library.
An anisotropic image segmentation algorithm consists of a gradient structure tensor calculation, an orientation calculation, a coherency calculation and an orientation and coherency thresholding:
The below code applies a thresholds LowThr and HighThr to image orientation and a threshold C_Thr to image coherency calculated by the previous function. LowThr and HighThr define orientation range:
Below you can see the real anisotropic image with single direction:
Anisotropic image with the single direction
Below you can see the orientation and coherency of the anisotropic image:
Orientation
Coherency
Below you can see the segmentation result:
Segmentation result
The result has been computed with w = 52, C_Thr = 0.43, LowThr = 35, HighThr = 57. We can see that the algorithm selected only the areas with one single direction.
References
Structure tensor - structure tensor description on the wikipedia
Generated on Mon Dec 21 2020 23:13:10 for OpenCV by 1.8.13