Class DocumentSpecification
java.lang.Object
com.microblink.blinkinput.entities.detectors.quad.Specification
com.microblink.blinkinput.entities.detectors.quad.document.DocumentSpecification
Class representing specification of document that can be detected with DocumentDetector.
-
Field Summary
Fields inherited from class com.microblink.blinkinput.entities.detectors.quad.Specification
mNativeContext -
Constructor Summary
ConstructorsConstructorDescriptionDocumentSpecification(double aspectRatio, float physicalHeightInInches) Constructor, defines aspect ratio of document that needs to be detected. -
Method Summary
Modifier and TypeMethodDescriptionstatic DocumentSpecificationCreates a new document that will be detected from preset.doubleReturns the aspect ratio of document that will be detected.Returns the detection mode that defines in which orientations can this document be detected.double[]Returns the scale and tolerance that will be used when detecting document in landscape orientation.doubleRetrieves maximum angle for document detectiondouble[]Returns the scale and tolerance that will be used when detecting document in portrait orientation.double[]Gets the percentage of possible document offset on x axis.double[]Gets the percentage of possible document offset on y axis.voidsetAspectRatio(double aspectRatio) Sets the aspect ratio of document that will be detected.voidSets the detection mode that defines in which orientations can this document be detected.voidsetLandscapeScale(double scale, double tolerance) Sets the scale and scale tolerance that will be used when detecting document in landscape orientation.voidsetMaxAngle(double maxAngle) Sets maximum angle for document detection.voidsetPortraitScale(double scale, double tolerance) Sets the scale and scale tolerance that will be used when detecting document in portrait orientation.voidsetScale(double scale, double tolerance) Sets the scale and scale tolerance that will be used when detecting document in both orientations.voidsetXRange(double leftRange, double rightRange) Sets percentage of possible document offset on x axis.voidsetYRange(double aboveRange, double belowRange) Sets percentage of possible document offset on y axis.protected voidterminateNative(long nativeContext) Methods inherited from class com.microblink.blinkinput.entities.detectors.quad.Specification
finalize, getPhysicalHeightInInches
-
Constructor Details
-
DocumentSpecification
public DocumentSpecification(@FloatRange(from=0.0,fromInclusive=false) double aspectRatio, @FloatRange(from=0.0,fromInclusive=false) float physicalHeightInInches) Constructor, defines aspect ratio of document that needs to be detected.- Parameters:
aspectRatio- Aspect ratio of the document, must be positivephysicalHeightInInches- Physical height of document in inches.
-
-
Method Details
-
getAspectRatio
public double getAspectRatio()Returns the aspect ratio of document that will be detected.- Returns:
- the aspect ratio of document that will be detected.
-
setAspectRatio
public void setAspectRatio(@FloatRange(from=0.0,fromInclusive=false) double aspectRatio) Sets the aspect ratio of document that will be detected.- Parameters:
aspectRatio- aspect ratio of document, must be positive
-
getDetectionMode
Returns the detection mode that defines in which orientations can this document be detected.- Returns:
- the detection mode that defines in which orientations can this document be detected.
-
setDetectionMode
Sets the detection mode that defines in which orientations can this document be detected.- Parameters:
mode- detection mode that defines in which orientations can this document be detected.
-
setLandscapeScale
public void setLandscapeScale(@FloatRange(from=0.0,fromInclusive=false,to=1.0) double scale, @FloatRange(from=0.0,to=1.0) double tolerance) Sets the scale and scale tolerance that will be used when detecting document in landscape orientation.- Parameters:
scale- Ideal scale defined as percentage of frame height at which document should be detected.tolerance- Scale tolerance is number that together with scale defines scale interval at which document can be detected. Scale interval is [scale-tolerance, scale+tolerance]
-
getLandscapeScale
@NonNull public double[] getLandscapeScale()Returns the scale and tolerance that will be used when detecting document in landscape orientation.- Returns:
- Array containing two numbers. First number (at index 0) will be scale and second (at index 1) will be scale tolerance.
-
setPortraitScale
public void setPortraitScale(@FloatRange(from=0.0,fromInclusive=false,to=1.0) double scale, @FloatRange(from=0.0,to=1.0) double tolerance) Sets the scale and scale tolerance that will be used when detecting document in portrait orientation.- Parameters:
scale- Ideal scale defined as percentage of frame height at which document should be detected.tolerance- Scale tolerance is number that together with scale defines scale interval at which document can be detected. Scale interval is [scale-tolerance, scale+tolerance]
-
getPortraitScale
@NonNull public double[] getPortraitScale()Returns the scale and tolerance that will be used when detecting document in portrait orientation.- Returns:
- Array containing two numbers. First number (at index 0) will be scale and second (at index 1) will be scale tolerance.
-
setScale
public void setScale(@FloatRange(from=0.0,fromInclusive=false,to=1.0) double scale, @FloatRange(from=0.0,to=1.0) double tolerance) Sets the scale and scale tolerance that will be used when detecting document in both orientations. This method is same as calling bothsetPortraitScale(double, double)andsetLandscapeScale(double, double)with same parameters.- Parameters:
scale- Ideal scale defined as percentage of frame height at which document should be detected.tolerance- Scale tolerance is number that together with scale defines scale interval at which document can be detected. Scale interval is [scale-tolerance, scale+tolerance]
-
setMaxAngle
public void setMaxAngle(@FloatRange(from=0.0,to=35.0) double maxAngle) Sets maximum angle for document detection. Allowed values are in interval [0, 35]- Parameters:
maxAngle- maximum angle for document detection. Allowed values are in interval [0, 35].
-
getMaxAngle
public double getMaxAngle()Retrieves maximum angle for document detection- Returns:
- maximum angle for document detection
-
setXRange
public void setXRange(@FloatRange(from=-1.0,to=0.0) double leftRange, @FloatRange(from=0.0,to=1.0) double rightRange) Sets percentage of possible document offset on x axis.- Parameters:
leftRange- possible left offset of centre. Value must be in range [-1, 0].rightRange- possible right offset of centre. Value must be in range [0, 1]
-
getXRange
@NonNull public double[] getXRange()Gets the percentage of possible document offset on x axis.- Returns:
- Array of two elements, first indicating the possible left offset of centre and second indicating the possible right offset of centre.
-
setYRange
public void setYRange(@FloatRange(from=-1.0,to=0.0) double aboveRange, @FloatRange(from=0.0,to=1.0) double belowRange) Sets percentage of possible document offset on y axis.- Parameters:
aboveRange- possible offset above centre. Value must be in range [-1, 0].belowRange- possible offset below centre. Value must be in range [0, 1]
-
getYRange
@NonNull public double[] getYRange()Gets the percentage of possible document offset on y axis.- Returns:
- Array of two elements, first indicating the possible offset above centre and second indicating the possible offset below centre.
-
terminateNative
protected void terminateNative(long nativeContext) - Specified by:
terminateNativein classSpecification
-
createFromPreset
@NonNull public static DocumentSpecification createFromPreset(@NonNull DocumentSpecificationPreset preset) Creates a new document that will be detected from preset.- Parameters:
preset- Preset defining which document detection settings should be created.- Returns:
- document created from given preset
-