Package org.datavec.image.transform
Class LargestBlobCropTransform
- java.lang.Object
-
- org.datavec.image.transform.BaseImageTransform<org.bytedeco.opencv.opencv_core.Mat>
-
- org.datavec.image.transform.LargestBlobCropTransform
-
- All Implemented Interfaces:
Operation<ImageWritable,ImageWritable>,ImageTransform
public class LargestBlobCropTransform extends BaseImageTransform<org.bytedeco.opencv.opencv_core.Mat>
-
-
Field Summary
Fields Modifier and Type Field Description protected intblurHeightprotected intblurWidthprotected booleanisCannyprotected intlowerThreshprotected intmethodprotected intmodeprotected Randomrngprotected intupperThresh-
Fields inherited from class org.datavec.image.transform.BaseImageTransform
converter, currentImage, random
-
-
Constructor Summary
Constructors Constructor Description LargestBlobCropTransform()Callsthis(nullLargestBlobCropTransform(Random random)Callsthis(random, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, 3, 3, 100, 200, true)LargestBlobCropTransform(Random random, int mode, int method, int blurWidth, int blurHeight, int lowerThresh, int upperThresh, boolean isCanny)
-
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 cropped image based on it's largest blob.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
-
-
-
-
Field Detail
-
rng
protected Random rng
-
mode
protected int mode
-
method
protected int method
-
blurWidth
protected int blurWidth
-
blurHeight
protected int blurHeight
-
upperThresh
protected int upperThresh
-
lowerThresh
protected int lowerThresh
-
isCanny
protected boolean isCanny
-
-
Constructor Detail
-
LargestBlobCropTransform
public LargestBlobCropTransform()
Callsthis(null
-
LargestBlobCropTransform
public LargestBlobCropTransform(Random random)
Callsthis(random, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, 3, 3, 100, 200, true)
-
LargestBlobCropTransform
public LargestBlobCropTransform(Random random, int mode, int method, int blurWidth, int blurHeight, int lowerThresh, int upperThresh, boolean isCanny)
- Parameters:
random- Object to use (or null for deterministic)mode- Contour retrieval modemethod- Contour approximation methodblurWidth- Width of blurring kernel sizeblurHeight- Height of blurring kernel sizelowerThresh- Lower threshold for either Canny or ThresholdupperThresh- Upper threshold for either Canny or ThresholdisCanny- Whether the edge detector is Canny or Threshold
-
-
Method Detail
-
doTransform
protected ImageWritable doTransform(ImageWritable image, Random random)
Takes an image and returns a cropped image based on it's largest blob.- 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
-
-