public class EigenTensors3 extends java.lang.Object implements Tensors3, java.io.Serializable
|a11 a12 a13|
A = |a12 a22 a23|
|a13 a23 a33|
Such tensors can be used to parameterize anisotropic image processing.
The eigen-decomposition of the matrix A is
A = au*u*u' + av*v*v' + aw*w*w'
= (au-av)*u*u' + (aw-av)*w*w' + av*I
where u, v, and w are orthogonal unit eigenvectors of A. (The notation
u' denotes the transpose of u.) The outer products of eigenvectors are
scaled by the non-negative eigenvalues au, av, and aw. The second
equation exploits the identity u*u' + v*v' + w*w' = I, and makes
apparent the redundancy of the vector v.
Only the 1st and 2nd components of the eigenvectors u and w are stored. Except for a sign, the 3rd components may be computed from the 1st and 2nd. Because the tensors are independent of the choice of sign, the eigenvectors u and w are stored with an implied non-negative 3rd component.
Storage may be further reduced by compression, whereby eigenvalues and eigenvectors are quantized. Quantization errors for eigenvalues (au,av,aw) are less than 0.001*(au+av+aw). Quantization errors for eigenvectors are less than one degree of arc on the unit sphere. Memory required to store each tensor is 12 bytes if compressed, and 28 bytes if not compressed.
Constructor and Description |
---|
EigenTensors3(EigenTensors3 t)
Constructs tensors from the specified tensors.
|
EigenTensors3(float[][][] u1,
float[][][] u2,
float[][][] w1,
float[][][] w2,
float[][][] au,
float[][][] av,
float[][][] aw,
boolean compressed)
Constructs tensors for specified array dimensions and eigenvalues.
|
EigenTensors3(int n1,
int n2,
int n3,
boolean compressed)
Constructs tensors for specified array dimensions.
|
Modifier and Type | Method and Description |
---|---|
void |
getEigenvalues(float[][][] au,
float[][][] av,
float[][][] aw)
Gets eigenvalues for all tensors.
|
float[] |
getEigenvalues(int i1,
int i2,
int i3)
Gets eigenvalues for the tensor with specified indices.
|
void |
getEigenvalues(int i1,
int i2,
int i3,
float[] a)
Gets eigenvalues for the tensor with specified indices.
|
float[] |
getEigenvectorU(int i1,
int i2,
int i3)
Gets the eigenvector u for the tensor with specified indices.
|
void |
getEigenvectorU(int i1,
int i2,
int i3,
float[] u)
Gets the eigenvector u for the tensor with specified indices.
|
float[] |
getEigenvectorV(int i1,
int i2,
int i3)
Gets the eigenvector v for the tensor with specified indices.
|
void |
getEigenvectorV(int i1,
int i2,
int i3,
float[] v)
Gets the eigenvector v for the tensor with specified indices.
|
float[] |
getEigenvectorW(int i1,
int i2,
int i3)
Gets the eigenvector w for the tensor with specified indices.
|
void |
getEigenvectorW(int i1,
int i2,
int i3,
float[] w)
Gets the eigenvector w for the tensor with specified indices.
|
int |
getN1()
Gets the number of tensors in the 1st dimension.
|
int |
getN2()
Gets the number of tensors in the 2nd dimension.
|
int |
getN3()
Gets the number of tensors in the 3rd dimension.
|
float[] |
getTensor(int i1,
int i2,
int i3)
Gets tensor elements for specified indices.
|
void |
getTensor(int i1,
int i2,
int i3,
float[] a)
Gets tensor elements for specified indices.
|
void |
invert()
Inverts these tensors by inverting their eigenvalues.
|
void |
invertStructure(double p0,
double p1,
double p2)
Inverts these tensors, assumed to be structure tensors.
|
void |
scale(float[][][] s)
Scales eigenvalues of these tensors by specified factors.
|
void |
setEigenvalues(float[][][] au,
float[][][] av,
float[][][] aw)
Sets eigenvalues for all tensors.
|
void |
setEigenvalues(float au,
float av,
float aw)
Sets eigenvalues for all tensors.
|
void |
setEigenvalues(int i1,
int i2,
int i3,
float[] a)
Sets eigenvalues for the tensor with specified indices.
|
void |
setEigenvalues(int i1,
int i2,
int i3,
float au,
float av,
float aw)
Sets eigenvalues for the tensor with specified indices.
|
void |
setEigenvectorU(int i1,
int i2,
int i3,
float[] u)
Sets the eigenvector u for the tensor with specified indices.
|
void |
setEigenvectorU(int i1,
int i2,
int i3,
float u1,
float u2,
float u3)
Sets the eigenvector u for the tensor with specified indices.
|
void |
setEigenvectorW(int i1,
int i2,
int i3,
float[] w)
Sets the eigenvector w for the tensor with specified indices.
|
void |
setEigenvectorW(int i1,
int i2,
int i3,
float w1,
float w2,
float w3)
Sets the eigenvector w for the tensor with specified indices.
|
void |
setTensor(int i1,
int i2,
int i3,
float[] a)
Sets tensor elements for specified indices.
|
void |
setTensor(int i1,
int i2,
int i3,
float a11,
float a12,
float a13,
float a22,
float a23,
float a33)
Sets tensor elements for specified indices.
|
public EigenTensors3(int n1, int n2, int n3, boolean compressed)
n1
- number of tensors in 1st dimension.n2
- number of tensors in 2nd dimension.n3
- number of tensors in 3rd dimension.compressed
- true, for compressed tensors; false, otherwise.public EigenTensors3(float[][][] u1, float[][][] u2, float[][][] w1, float[][][] w2, float[][][] au, float[][][] av, float[][][] aw, boolean compressed)
u1
- array of 1st components of u.u2
- array of 2nd components of u.w1
- array of 1st components of w.w2
- array of 2nd components of w.au
- array of eigenvalues au.av
- array of eigenvalues av.aw
- array of eigenvalues aw.compressed
- true, for compressed tensors; false, otherwise.public EigenTensors3(EigenTensors3 t)
t
- the tensors from which to copy eigenvectors and eigenvalues.public int getN1()
public int getN2()
public int getN3()
public void getTensor(int i1, int i2, int i3, float[] a)
public float[] getTensor(int i1, int i2, int i3)
i1
- index for 1st dimension.i2
- index for 2nd dimension.i3
- index for 3rd dimension.public void getEigenvalues(int i1, int i2, int i3, float[] a)
i1
- index for 1st dimension.i2
- index for 2nd dimension.i3
- index for 3rd dimension.a
- array {au,av,aw} of eigenvalues.public float[] getEigenvalues(int i1, int i2, int i3)
i1
- index for 1st dimension.i2
- index for 2nd dimension.i3
- index for 3rd dimension.public void getEigenvalues(float[][][] au, float[][][] av, float[][][] aw)
au
- array of eigenvalues au.av
- array of eigenvalues av.aw
- array of eigenvalues aw.public void getEigenvectorU(int i1, int i2, int i3, float[] u)
i1
- index for 1st dimension.i2
- index for 2nd dimension.i3
- index for 3rd dimension.u
- array {u1,u2,u3} of eigenvector components.public float[] getEigenvectorU(int i1, int i2, int i3)
i1
- index for 1st dimension.i2
- index for 2nd dimension.i3
- index for 3rd dimension.public void getEigenvectorV(int i1, int i2, int i3, float[] v)
i1
- index for 1st dimension.i2
- index for 2nd dimension.i3
- index for 3rd dimension.v
- array {v1,v2,v3} of eigenvector components.public float[] getEigenvectorV(int i1, int i2, int i3)
i1
- index for 1st dimension.i2
- index for 2nd dimension.i3
- index for 3rd dimension.public void getEigenvectorW(int i1, int i2, int i3, float[] w)
i1
- index for 1st dimension.i2
- index for 2nd dimension.i3
- index for 3rd dimension.w
- array {w1,w2,w3} of eigenvector components.public float[] getEigenvectorW(int i1, int i2, int i3)
i1
- index for 1st dimension.i2
- index for 2nd dimension.i3
- index for 3rd dimension.public void setTensor(int i1, int i2, int i3, float[] a)
i1
- index for 1st dimension.i2
- index for 2nd dimension.i3
- index for 3rd dimension.a
- array {a11,a12,a13,a22,a23,a33} of tensor elements.public void setTensor(int i1, int i2, int i3, float a11, float a12, float a13, float a22, float a23, float a33)
i1
- index for 1st dimension.i2
- index for 2nd dimension.i3
- index for 3rd dimension.a11
- tensor element a11.a12
- tensor element a12.a13
- tensor element a13.a22
- tensor element a22.a23
- tensor element a23.a33
- tensor element a33.public void setEigenvalues(float au, float av, float aw)
au
- eigenvalue au.av
- eigenvalue av.aw
- eigenvalue aw.public void setEigenvalues(float[][][] au, float[][][] av, float[][][] aw)
au
- array of eigenvalues au.av
- array of eigenvalues av.aw
- array of eigenvalues aw.public void setEigenvalues(int i1, int i2, int i3, float au, float av, float aw)
i1
- index for 1st dimension.i2
- index for 2nd dimension.i3
- index for 3rd dimension.au
- eigenvalue au.av
- eigenvalue av.aw
- eigenvalue aw.public void setEigenvalues(int i1, int i2, int i3, float[] a)
i1
- index for 1st dimension.i2
- index for 2nd dimension.i3
- index for 3rd dimension.a
- array {au,av,aw} of eigenvalues.public void setEigenvectorU(int i1, int i2, int i3, float u1, float u2, float u3)
i1
- index for 1st dimension.i2
- index for 2nd dimension.i3
- index for 3rd dimension.u1
- 1st component of u.u2
- 2nd component of u.u3
- 3nd component of u.public void setEigenvectorU(int i1, int i2, int i3, float[] u)
i1
- index for 1st dimension.i2
- index for 2nd dimension.i3
- index for 3rd dimension.u
- {u1,u2,u3} of eigenvector components.public void setEigenvectorW(int i1, int i2, int i3, float w1, float w2, float w3)
i1
- index for 1st dimension.i2
- index for 2nd dimension.i3
- index for 3rd dimension.w1
- 1st component of w.w2
- 2nd component of w.w3
- 3nd component of w.public void setEigenvectorW(int i1, int i2, int i3, float[] w)
i1
- index for 1st dimension.i2
- index for 2nd dimension.i3
- index for 3rd dimension.w
- {w1,w2,w3} of eigenvector components.public void scale(float[][][] s)
s
- array of scale factors.public void invert()
public void invertStructure(double p0, double p1, double p2)
Before inversion, tensors are assumed to be structure tensors,
for which eigenvalues au are not less than their corresponding
eigenvalues av which are not less than their corresponding aw.
(Any eigenvalues au for which this condition is not satisfied
are set equal to the corresponding eigenvalue av; likewise for
av and aw.) Structure tensors can, for example, be computed using
LocalOrientFilter
.
Then, if any eigenvalues are equal to zero, this method adds a small fraction of the largest eigenvalue au to all eigenvalues. If am is the minimum of the eigenvalues aw after this perturbation, then the parameter p0 is used to compute a0 = pow(am/aw,p0), the parameter p1 is used to compute a1 = pow(aw/av,p1), and the parameter p2 is used to compute a2 = pow(av/au,p2). Inverted eigenvalues are then au = a0*a1*a2, av = a0*a1 and aw = a0.
In this way, p0 emphasizes overall amplitude, p1 emphasizes linearity and p2 emphasizes planarity. For amplitude-independent tensors with all eigenvalues av equal to one, set p0 = 0.0. To enhance linearity, set p1 > 1.0. To enhance planarity, set p2 > 1.0. To simply invert (and normalize) these tensors, set p0 = p1 = p2 = 1.0.
p0
- power for amplitude.p1
- power for linearity.p2
- power for planarity.