Package org.datavec.image.transform
Class CropImageTransform
- java.lang.Object
-
- org.datavec.image.transform.BaseImageTransform<org.bytedeco.opencv.opencv_core.Mat>
-
- org.datavec.image.transform.CropImageTransform
-
- All Implemented Interfaces:
Operation<ImageWritable,ImageWritable>,ImageTransform
public class CropImageTransform extends BaseImageTransform<org.bytedeco.opencv.opencv_core.Mat>
-
-
Field Summary
-
Fields inherited from class org.datavec.image.transform.BaseImageTransform
converter, currentImage, random
-
-
Constructor Summary
Constructors Constructor Description CropImageTransform(int crop)Callsthis(null, crop, crop, crop, crop).CropImageTransform(int cropTop, int cropLeft, int cropBottom, int cropRight)Callsthis(random, cropTop, cropLeft, cropBottom, cropRight).CropImageTransform(Random random, int crop)Callsthis(random, crop, crop, crop, crop).CropImageTransform(Random random, int cropTop, int cropLeft, int cropBottom, int cropRight)Constructs an instance of the ImageTransform.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ImageWritabledoTransform(ImageWritable image, Random random)Takes an image and returns a transformed image.float[]query(float... coordinates)Transforms the given coordinates using the parameters that were used to transform the last image.-
Methods inherited from class org.datavec.image.transform.BaseImageTransform
getCurrentImage, transform, transform
-
-
-
-
Constructor Detail
-
CropImageTransform
public CropImageTransform(int crop)
Callsthis(null, crop, crop, crop, crop).
-
CropImageTransform
public CropImageTransform(Random random, int crop)
Callsthis(random, crop, crop, crop, crop).
-
CropImageTransform
public CropImageTransform(int cropTop, int cropLeft, int cropBottom, int cropRight)Callsthis(random, cropTop, cropLeft, cropBottom, cropRight).
-
CropImageTransform
public CropImageTransform(Random random, int cropTop, int cropLeft, int cropBottom, int cropRight)
Constructs an instance of the ImageTransform.- Parameters:
random- object to use (or null for deterministic)cropTop- maximum cropping of the top of the image (pixels)cropLeft- maximum cropping of the left of the image (pixels)cropBottom- maximum cropping of the bottom of the image (pixels)cropRight- maximum cropping of the right of the image (pixels)
-
-
Method Detail
-
doTransform
protected ImageWritable doTransform(ImageWritable image, Random random)
Takes an image and returns a transformed image. Uses the random object in the case of random transformations.- Specified by:
doTransformin classBaseImageTransform<org.bytedeco.opencv.opencv_core.Mat>- Parameters:
image- to transform, null == end of streamrandom- object to use (or null for deterministic)- Returns:
- transformed image
-
query
public float[] query(float... coordinates)
Description copied from interface:ImageTransformTransforms the given coordinates using the parameters that were used to transform the last image.- Specified by:
queryin interfaceImageTransform- Overrides:
queryin classBaseImageTransform<org.bytedeco.opencv.opencv_core.Mat>- Parameters:
coordinates- to transforms (x1, y1, x2, y2, ...)- Returns:
- transformed coordinates
-
-