Class ImageExtensionFactors
- java.lang.Object
-
- com.microblink.entities.recognizers.blinkid.imageoptions.extension.ImageExtensionFactors
-
public class ImageExtensionFactors extends java.lang.Object
Extension factors relative to corresponding dimension of the full image. For example,upFactor
anddownFactor
define extensions relative to image height, e.g. whenupFactor
is 0.5, upper image boundary will be extended for half of image's full height.
-
-
Constructor Summary
Constructors Constructor Description ImageExtensionFactors(float upFactor, float downFactor, float leftFactor, float rightFactor)
Constructor which accepts image extension factors which must be in range [0.0f, 1.0f].
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImageExtensionFactors
createFromArray(float[] factors)
Creates factors object from float array.float
getDownFactor()
Returns currently used image extension factor relative to full image height in DOWN direction.float
getLeftFactor()
Returns currently used image extension factor relative to full image width in LEFT direction.float
getRightFactor()
Returns currently used image extension factor relative to full image width in RIGHT direction.float
getUpFactor()
Returns currently used image extension factor relative to full image height in UP direction.float[]
serializeToArray()
Serializes factors to array, factors are placed in resulting array in the following order [upFactor, rightFactor, downFactor, leftFactor].
-
-
-
Constructor Detail
-
ImageExtensionFactors
public ImageExtensionFactors(@FloatRange(from=0.0,to=1.0) float upFactor, @FloatRange(from=0.0,to=1.0) float downFactor, @FloatRange(from=0.0,to=1.0) float leftFactor, @FloatRange(from=0.0,to=1.0) float rightFactor)
Constructor which accepts image extension factors which must be in range [0.0f, 1.0f].- Parameters:
upFactor
- image extension factor relative to full image height in UP directiondownFactor
- image extension factor relative to full image height in DOWN directionleftFactor
- image extension factor relative to full image width in LEFT directionrightFactor
- image extension factor relative to full image width in RIGHT direction
-
-
Method Detail
-
getUpFactor
@FloatRange(from=0.0, to=1.0) public float getUpFactor()
Returns currently used image extension factor relative to full image height in UP direction.- Returns:
- currently used image extension factor relative to full image height in UP direction.
-
getDownFactor
@FloatRange(from=0.0, to=1.0) public float getDownFactor()
Returns currently used image extension factor relative to full image height in DOWN direction.- Returns:
- currently used image extension factor relative to full image height in DOWN direction.
-
getRightFactor
@FloatRange(from=0.0, to=1.0) public float getRightFactor()
Returns currently used image extension factor relative to full image width in RIGHT direction.- Returns:
- currently used image extension factor relative to full image width in RIGHT direction.
-
getLeftFactor
@FloatRange(from=0.0, to=1.0) public float getLeftFactor()
Returns currently used image extension factor relative to full image width in LEFT direction.- Returns:
- currently used image extension factor relative to full image width in LEFT direction.
-
serializeToArray
@NonNull @Size(4L) public float[] serializeToArray()
Serializes factors to array, factors are placed in resulting array in the following order [upFactor, rightFactor, downFactor, leftFactor].- Returns:
- factors serialized to array in the following order: [upFactor, rightFactor, downFactor, leftFactor].
-
createFromArray
@NonNull public static final ImageExtensionFactors createFromArray(@Size(4L) @NonNull float[] factors)
Creates factors object from float array. Expected factors order in array is: [upFactor, rightFactor, downFactor, leftFactor].- Parameters:
factors
- factors array, expected order of factors is: [upFactor, rightFactor, downFactor, leftFactor]. Factors must be in range [0.0, 1.0].- Returns:
- factors object created from the given array of factors.
-
-