Class ImageExtensionFactors
java.lang.Object
com.microblink.blinkcard.entities.recognizers.blinkid.imageoptions.extension.ImageExtensionFactors
Extension factors relative to corresponding dimension of the full image. For example,
upFactor
and downFactor
define extensions relative to image height, e.g.
when upFactor
is 0.5, upper image boundary will be extended for half of image's full
height.-
Constructor Summary
ConstructorsConstructorDescriptionImageExtensionFactors
(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
Modifier and TypeMethodDescriptionstatic final ImageExtensionFactors
createFromArray
(float[] factors) Creates factors object from float array.float
Returns currently used image extension factor relative to full image height in DOWN direction.float
Returns currently used image extension factor relative to full image width in LEFT direction.float
Returns currently used image extension factor relative to full image width in RIGHT direction.float
Returns currently used image extension factor relative to full image height in UP direction.float[]
Serializes factors to array, factors are placed in resulting array in the following order [upFactor, rightFactor, downFactor, leftFactor].
-
Constructor Details
-
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 Details
-
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.
-