public class EllipticFourierDesc extends Object
The EFD provides a normalized set of coefficients that are rotation, translation and scale invariant. The very first coefficient relates to the centroid of the input shape before the EFD is computed and can be ignored; the second FD coefficient relates to a circle circumscribed about the centroid before the EFD computation. After the EFD computation the second EFD is always 2 and can be ignored. That leaves the remaining EFD coefficients for use in comparing shapes.
Constructor and Description |
---|
EllipticFourierDesc(org.locationtech.jts.geom.LinearRing ring)
Constructs a descriptor object for a given polygon and computes
#vertices/2 Elliptical Fourier Descriptors for it. |
EllipticFourierDesc(org.locationtech.jts.geom.LinearRing ring,
int n)
Constructs a descriptor object for a given polygon and computes the
Elliptical Fourier Descriptors for it.
|
Modifier and Type | Method and Description |
---|---|
static double |
computeEFDDistance(double[] efd1,
double[] efd2)
Computes pairwise euclidean distance between two descriptors (of equal
length).
|
org.locationtech.jts.geom.Coordinate[] |
createPolygon()
Returns the polygon computed using all of this instance's EFD coefficients.
|
org.locationtech.jts.geom.Coordinate[] |
createPolygon(int n)
Creates the polygon corresponding to the nth harmonic.
|
double[] |
getEFD()
Returns the elliptic fourier descriptors, which are computed upon
initialisation.
|
public EllipticFourierDesc(org.locationtech.jts.geom.LinearRing ring, int n)
coords
- A two-dimensional array representing the vertices of the
polygon. Each row contains the x and y coordinates of a vertex.n
- The number of Fourier descriptors to compute. This is also the
number of harmonics used in the Fourier series. >=2.public EllipticFourierDesc(org.locationtech.jts.geom.LinearRing ring)
#vertices/2
Elliptical Fourier Descriptors for it.x
- the x coordinates of the contoury
- the y coordinates of the contourpublic double[] getEFD()
The very first coefficient relates to the centroid of the input shape before the EFD is computed and can be ignored; the second FD coefficient relates to a circle circumscribed about the centroid before the EFD computation -- after the EFD computation this second EFD is always 2 and can be ignored.
public org.locationtech.jts.geom.Coordinate[] createPolygon()
public org.locationtech.jts.geom.Coordinate[] createPolygon(int n)
n
- >= 2.public static double computeEFDDistance(double[] efd1, double[] efd2)
Copyright © 2023. All rights reserved.