public class DocumentSpecification extends Specification
mNativeContext
Constructor and Description |
---|
DocumentSpecification(double aspectRatio,
float physicalHeightInInches)
Constructor, defines aspect ratio of document that needs to be detected.
|
Modifier and Type | Method and Description |
---|---|
static DocumentSpecification |
createFromPreset(DocumentSpecificationPreset preset)
Creates a new document that will be detected from preset.
|
double |
getAspectRatio()
Returns the aspect ratio of document that will be detected.
|
DetectionMode |
getDetectionMode()
Returns the detection mode that defines in which orientations can this document be detected.
|
double[] |
getLandscapeScale()
Returns the scale and tolerance that will be used when detecting document in landscape orientation.
|
double |
getMaxAngle()
Retrieves maximum angle for document detection
|
double[] |
getPortraitScale()
Returns the scale and tolerance that will be used when detecting document in portrait orientation.
|
double[] |
getXRange()
Gets the percentage of possible document offset on x axis.
|
double[] |
getYRange()
Gets the percentage of possible document offset on y axis.
|
void |
setAspectRatio(double aspectRatio)
Sets the aspect ratio of document that will be detected.
|
void |
setDetectionMode(DetectionMode mode)
Sets the detection mode that defines in which orientations can this document be detected.
|
void |
setLandscapeScale(double scale,
double tolerance)
Sets the scale and scale tolerance that will be used when detecting document in landscape orientation.
|
void |
setMaxAngle(double maxAngle)
Sets maximum angle for document detection.
|
void |
setPortraitScale(double scale,
double tolerance)
Sets the scale and scale tolerance that will be used when detecting document in portrait orientation.
|
void |
setScale(double scale,
double tolerance)
Sets the scale and scale tolerance that will be used when detecting document in both orientations.
|
void |
setXRange(double leftRange,
double rightRange)
Sets percentage of possible document offset on x axis.
|
void |
setYRange(double aboveRange,
double belowRange)
Sets percentage of possible document offset on y axis.
|
protected void |
terminateNative(long nativeContext) |
finalize, getPhysicalHeightInInches
public DocumentSpecification(double aspectRatio, float physicalHeightInInches)
aspectRatio
- Aspect ratio of the document, must be positivephysicalHeightInInches
- Physical height of document in inches.public double getAspectRatio()
public void setAspectRatio(double aspectRatio)
aspectRatio
- aspect ratio of document, must be positive@NonNull public DetectionMode getDetectionMode()
public void setDetectionMode(@NonNull DetectionMode mode)
mode
- detection mode that defines in which orientations can this document be detected.public void setLandscapeScale(double scale, double tolerance)
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]@NonNull public double[] getLandscapeScale()
public void setPortraitScale(double scale, double tolerance)
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]@NonNull public double[] getPortraitScale()
public void setScale(double scale, double tolerance)
DocumentSpecification.setPortraitScale(double, double)
and DocumentSpecification.setLandscapeScale(double, double)
with same 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]public void setMaxAngle(double maxAngle)
maxAngle
- maximum angle for document detection. Allowed values are in interval [0, 35].public double getMaxAngle()
public void setXRange(double leftRange, double rightRange)
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]@NonNull public double[] getXRange()
public void setYRange(double aboveRange, double belowRange)
aboveRange
- possible offset above centre. Value must be in range [-1, 0].belowRange
- possible offset below centre. Value must be in range [0, 1]@NonNull public double[] getYRange()
protected void terminateNative(long nativeContext)
terminateNative
in class Specification
@NonNull public static DocumentSpecification createFromPreset(@NonNull DocumentSpecificationPreset preset)
preset
- Preset defining which document detection settings should be created.