public class DistortImageOps
extends java.lang.Object
Provides common function for distorting images.
Constructor and Description |
---|
DistortImageOps() |
Modifier and Type | Method and Description |
---|---|
static <T extends ImageBase> |
affine(T input,
T output,
TypeInterpolate interpType,
double a11,
double a12,
double a21,
double a22,
double dx,
double dy)
Applies an affine transformation from the input image to the output image.
|
static Rectangle2D_F32 |
boundBox_F32(int srcWidth,
int srcHeight,
PixelTransform_F32 transform)
Finds an axis-aligned bounding box which would contain a image after it has been transformed.
|
static Rectangle2D_I32 |
boundBox(int srcWidth,
int srcHeight,
int dstWidth,
int dstHeight,
PixelTransform_F32 transform)
Finds an axis-aligned bounding box which would contain a image after it has been transformed.
|
static Rectangle2D_I32 |
boundBox(int srcWidth,
int srcHeight,
PixelTransform_F32 transform)
Finds an axis-aligned bounding box which would contain a image after it has been transformed.
|
static <T extends ImageSingleBand> |
createImageDistort(PointTransform_F32 transform,
TypeInterpolate interpType,
java.lang.Class<T> imageType)
Easy way to create
ImageDistort given PixelTransform_F32 . |
static <T extends ImageSingleBand,M extends MultiSpectral<T>> |
distortMS(M input,
M output,
PixelTransform_F32 transform,
boolean skipOutsidePixels,
TypeInterpolate interpType)
Applies a pixel transform to a
MultiSpectral image. |
static <T extends ImageSingleBand> |
distortMS(MultiSpectral<T> input,
MultiSpectral<T> output,
ImageDistort<T> distortion)
Applies a distortion to a
MultiSpectral image. |
static <T extends ImageSingleBand> |
distortSingle(T input,
T output,
PixelTransform_F32 transform,
boolean skipOutsidePixels,
TypeInterpolate interpType)
Applies a pixel transform to a single band image.
|
static <T extends ImageSingleBand> |
distortSingle(T input,
T output,
PixelTransform_F32 transform,
ImageBorder<T> border,
InterpolatePixel<T> interp)
Applies a pixel transform to a single band image.
|
static <T extends ImageBase> |
rotate(T input,
T output,
TypeInterpolate interpType,
float angleInputToOutput)
Rotates the image using the specified interpolation type.
|
static <T extends ImageBase> |
scale(T input,
T output,
TypeInterpolate interpType)
Rescales the input image and writes the results into the output image.
|
public static <T extends ImageBase> void affine(T input, T output, TypeInterpolate interpType, double a11, double a12, double a21, double a22, double dx, double dy)
Applies an affine transformation from the input image to the output image.
Input coordinates (x,y) to output coordinate (x',y')
x' = a11*x + a12*y + dx
y' = a21*x + a22*y + dy
input
- Which which is being rotated.output
- The image in which the output is written to.interpType
- Which type of interpolation will be used.public static <T extends ImageSingleBand> void distortSingle(T input, T output, PixelTransform_F32 transform, boolean skipOutsidePixels, TypeInterpolate interpType)
input
- Input (source) image.output
- Where the result of transforming the image image is written to.transform
- The transform that is being applied to the imageskipOutsidePixels
- Should pixels that go outside the source image be skipped over
or set to the value of zero.interpType
- Which type of pixel interpolation should be used. BILINEAR is in general recommendedpublic static <T extends ImageSingleBand> void distortSingle(T input, T output, PixelTransform_F32 transform, ImageBorder<T> border, InterpolatePixel<T> interp)
input
- Input (source) image.output
- Where the result of transforming the image image is written to.transform
- The transform that is being applied to the imageborder
- How border pixels are handled.interp
- Interpolation algorithm.public static <T extends ImageSingleBand,M extends MultiSpectral<T>> void distortMS(M input, M output, PixelTransform_F32 transform, boolean skipOutsidePixels, TypeInterpolate interpType)
MultiSpectral
image.input
- Input (source) image.output
- Where the result of transforming the image image is written to.transform
- The transform that is being applied to the imageskipOutsidePixels
- Should pixels that go outside the source image be skipped over
or set to the value of zero.interpType
- Which type of pixel interpolation should be used.public static <T extends ImageSingleBand> ImageDistort<T> createImageDistort(PointTransform_F32 transform, TypeInterpolate interpType, java.lang.Class<T> imageType)
ImageDistort
given PixelTransform_F32
. To improve
performance the distortion is automatically cached.transform
- Image transform.interpType
- Which interpolation. Try bilinear.imageType
- Image of single band image it will process.ImageDistort
FactoryDistort
,
FactoryInterpolation
public static <T extends ImageBase> void scale(T input, T output, TypeInterpolate interpType)
input
- Input image. Not modified.output
- Rescaled input image. Modified.interpType
- Which interpolation algorithm should be used.public static <T extends ImageBase> void rotate(T input, T output, TypeInterpolate interpType, float angleInputToOutput)
Rotates the image using the specified interpolation type. The rotation is performed around the specified center of rotation in the input image.
Input coordinates (x,y) to output coordinate (x',y')
x' = x_c + c*(x-x_c) - s(y - y_c)
y' = y_c + s*(x-x_c) + c(y - y_c)
input
- Which which is being rotated.output
- The image in which the output is written to.interpType
- Which type of interpolation will be used.angleInputToOutput
- Angle of rotation in radians. From input to output, CCW rotation.public static <T extends ImageSingleBand> void distortMS(MultiSpectral<T> input, MultiSpectral<T> output, ImageDistort<T> distortion)
MultiSpectral
image.T
- Band type.input
- Image being distorted. Not modified.output
- Output image. modified.distortion
- The distortion modelpublic static Rectangle2D_I32 boundBox(int srcWidth, int srcHeight, int dstWidth, int dstHeight, PixelTransform_F32 transform)
srcWidth
- Width of the source imagesrcHeight
- Height of the source imagedstWidth
- Width of the destination imagedstHeight
- Height of the destination imagetransform
- Transform being applied to the imagepublic static Rectangle2D_I32 boundBox(int srcWidth, int srcHeight, PixelTransform_F32 transform)
srcWidth
- Width of the source imagesrcHeight
- Height of the source imagetransform
- Transform being applied to the imagepublic static Rectangle2D_F32 boundBox_F32(int srcWidth, int srcHeight, PixelTransform_F32 transform)
srcWidth
- Width of the source imagesrcHeight
- Height of the source imagetransform
- Transform being applied to the imageCopyright © 2011-2012 Peter Abeles