|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectFormattable
AbstractMathTransform
WarpTransform2D
public class WarpTransform2D
Wraps an arbitrary Warp
object as a two-dimensional transform.
Calls to transform methods are forwarded to
the warpPoint
method, or something equivalent. This
implies that source coordinates may be rounded to nearest integers before the transformation
is applied.
This transform is typically used with grid coverage "Resample" operation for reprojecting an image. Source and destination coordinates are usually pixel coordinates in source and target image, which is why this transform may use integer arithmetic.
This math transform can be created alone (by invoking its public constructors directly), or it
can be created by a factory like LocalizationGrid
.
For more information on image warp, see Geometric Image Manipulation in the Programming in Java Advanced Imaging guide.
LocalizationGrid.getPolynomialTransform(int)
,
Warp
,
WarpOpImage
,
WarpDescriptor
,
Serialized Form
modules/library/referencing (gt-referencing.jar)
Nested Class Summary | |
---|---|
static class |
WarpTransform2D.Provider
The provider for the WarpTransform2D . |
Nested classes/interfaces inherited from class AbstractMathTransform |
---|
AbstractMathTransform.Inverse |
Field Summary | |
---|---|
static int |
MAX_DEGREE
The maximal polynomial degree allowed. |
Fields inherited from class Formattable |
---|
SINGLE_LINE |
Constructor Summary | |
---|---|
|
WarpTransform2D(Point2D[] srcCoords,
Point2D[] dstCoords,
int degree)
Constructs a warp transform that approximatively maps the given source coordinates to the given destination coordinates. |
|
WarpTransform2D(Rectangle2D srcBounds,
float[] srcCoords,
int srcOffset,
Rectangle2D dstBounds,
float[] dstCoords,
int dstOffset,
int numCoords,
int degree)
Constructs a warp transform that approximatively maps the given source coordinates to the given destination coordinates. |
|
WarpTransform2D(Rectangle2D srcBounds,
Point2D[] srcCoords,
int srcOffset,
Rectangle2D dstBounds,
Point2D[] dstCoords,
int dstOffset,
int numCoords,
int degree)
Constructs a warp transform that approximatively maps the given source coordinates to the given destination coordinates. |
protected |
WarpTransform2D(Warp warp,
Warp inverse)
Constructs a transform using the specified warp object. |
Method Summary | |
---|---|
static MathTransform2D |
create(Warp warp)
Returns a transform using the specified warp object. |
boolean |
equals(Object object)
Compares this transform with the specified object for equality. |
ParameterDescriptorGroup |
getParameterDescriptors()
Returns the parameter descriptors for this math transform. |
ParameterValueGroup |
getParameterValues()
Returns the parameter values for this math transform. |
int |
getSourceDimensions()
Returns the dimension of input points. |
int |
getTargetDimensions()
Returns the dimension of output points. |
Warp |
getWarp()
Returns image warp wrapped by this transform. |
static Warp |
getWarp(CharSequence name,
MathTransform2D transform)
Returns a image warp for the specified transform. |
int |
hashCode()
Returns a hash value for this transform. |
MathTransform2D |
inverse()
Returns the inverse transform. |
boolean |
isIdentity()
Tests if this transform is the identity transform. |
void |
transform(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
Transforms source coordinates (usually pixel indices) into destination coordinates (usually "real world" coordinates). |
void |
transform(float[] srcPts,
int srcOff,
float[] dstPts,
int dstOff,
int numPts)
Transforms source coordinates (usually pixel indices) into destination coordinates (usually "real world" coordinates). |
Point2D |
transform(Point2D ptSrc,
Point2D ptDst)
Transforms source coordinates (usually pixel indices) into destination coordinates (usually "real world" coordinates). |
Methods inherited from class AbstractMathTransform |
---|
createTransformedShape, derivative, derivative, ensureNonNull, formatWKT, getName, needCopy, rollLongitude, transform, transform, transform |
Methods inherited from class Formattable |
---|
toString, toWKT, toWKT, toWKT |
Methods inherited from class Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface MathTransform2D |
---|
createTransformedShape, derivative |
Methods inherited from interface MathTransform |
---|
derivative, toWKT, transform, transform, transform |
Field Detail |
---|
public static final int MAX_DEGREE
Constructor Detail |
---|
public WarpTransform2D(Point2D[] srcCoords, Point2D[] dstCoords, int degree)
Degree of Warp | Number of Points |
---|---|
1 | 3 |
2 | 6 |
3 | 10 |
4 | 15 |
5 | 21 |
6 | 28 |
7 | 36 |
srcCoords
- Source coordinates.dstCoords
- Destination coordinates.degree
- The desired degree of the warp polynomials.public WarpTransform2D(Rectangle2D srcBounds, Point2D[] srcCoords, int srcOffset, Rectangle2D dstBounds, Point2D[] dstCoords, int dstOffset, int numCoords, int degree)
srcBounds
- Bounding box of source coordinates, or null
if unknow.srcCoords
- Source coordinates.srcOffset
- The inital entry of srcCoords
to be used.dstBounds
- Bounding box of destination coordinates, or null
if unknow.dstCoords
- Destination coordinates.dstOffset
- The inital entry of destCoords
to be used.numCoords
- The number of coordinates from srcCoords
and destCoords
to be used.degree
- The desired degree of the warp polynomials.public WarpTransform2D(Rectangle2D srcBounds, float[] srcCoords, int srcOffset, Rectangle2D dstBounds, float[] dstCoords, int dstOffset, int numCoords, int degree)
srcBounds
- Bounding box of source coordinates, or null
if unknow.srcCoords
- Source coordinates with x and y alternating.srcOffset
- The inital entry of srcCoords
to be used.dstBounds
- Bounding box of destination coordinates, or null
if unknow.dstCoords
- Destination coordinates with x and y alternating.dstOffset
- The inital entry of destCoords
to be used.numCoords
- The number of coordinates from srcCoords
and destCoords
to be used.degree
- The desired degree of the warp polynomials.protected WarpTransform2D(Warp warp, Warp inverse)
warpPoint
method or something equivalent.
warp
- The image warp to wrap into a math transform.inverse
- An image warp to uses for the inverse transform,
or null
in none.Method Detail |
---|
public static MathTransform2D create(Warp warp)
warpPoint
method or something equivalent.
warp
- The image warp to wrap into a math transform.
public static Warp getWarp(CharSequence name, MathTransform2D transform)
Warp.warpPoint
method transforms coordinates from
source to target CRS. Note that JAI's warp operation needs a warp object with the opposite semantic (i.e. the image warp must
transforms coordinates from target to source CRS). Consequently, consider invoking
getWarp(transform.inverse())
if the warp object is going to be used in an
image reprojection.
name
- The image or coverage
name, or null
in unknow. Used only for formatting error message if some
TransformException
are thrown by the
supplied transform.transform
- The transform to returns as an image warp.
public Warp getWarp()
Warp.warpPoint
method transforms coordinates from
source to target CRS. Note that JAI's warp operation needs a warp object with the opposite semantic (i.e. the image warp must
transforms coordinates from target to source CRS). Consequently, consider invoking
inverse.getWarp()
if the warp object is going to be used in an
image reprojection.
public ParameterDescriptorGroup getParameterDescriptors()
getParameterDescriptors
in class AbstractMathTransform
null
.OperationMethod.getParameters()
public ParameterValueGroup getParameterValues()
getParameterValues
in class AbstractMathTransform
null
.Operation.getParameterValues()
public int getSourceDimensions()
getSourceDimensions
in interface MathTransform
getSourceDimensions
in class AbstractMathTransform
public int getTargetDimensions()
getTargetDimensions
in interface MathTransform
getTargetDimensions
in class AbstractMathTransform
public boolean isIdentity()
isIdentity
in interface MathTransform
isIdentity
in class AbstractMathTransform
public Point2D transform(Point2D ptSrc, Point2D ptDst)
transform
in interface MathTransform2D
transform
in class AbstractMathTransform
ptSrc
- the specified coordinate point to be transformed.ptDst
- the specified coordinate point that stores the result of transforming
ptSrc
, or null
.
ptSrc
and storing the result in
ptDst
.MathTransform2D.transform(Point2D,Point2D)
public void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
transform
in interface MathTransform
transform
in class AbstractMathTransform
public void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
transform
in interface MathTransform
public MathTransform2D inverse() throws NoninvertibleTransformException
inverse
in interface MathTransform
inverse
in interface MathTransform2D
inverse
in class AbstractMathTransform
NoninvertibleTransformException
- if no inverse warp were specified at construction time.public int hashCode()
hashCode
in class AbstractMathTransform
public boolean equals(Object object)
equals
in class AbstractMathTransform
object
- The object to compare with this transform.
true
if the given object is a transform of the same class
and if, given identical source position, the
transformed
position would be the equals.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |