Kofax Mobile SDK API Reference
Public Member Functions | Protected Member Functions | List of all members
DetectionSettings Class Referenceabstract
Inheritance diagram for DetectionSettings:
CheckDetectionSettings DocumentDetectionSettings PassportDetectionSettings

Public Member Functions

 DetectionSettings (Point targetFrameCenter, double targetFrameAspectRatio, double targetFramePaddingPercent)
 Constructor creates a document detection setting object that has specified values. More...
 
Point getCenterPoint ()
 Gets the center point within the image of the target frame. More...
 
void setCenterPoint (Point targetFrameCenter)
 Sets the center point within the image of the target frame. More...
 
double getTargetFrameAspectRatio ()
 Gets the aspect ratio of the rectangular frame that should match the document being searched. More...
 
void setTargetFrameAspectRatio (double targetFrameAspectRatio)
 Sets the aspect ratio of the rectangular frame that should match the document being searched. More...
 
double getTargetFramePaddingPercent ()
 Gets the minimum padding in percent length to be maintained between the edges of the target frame and image. More...
 
void setTargetFramePaddingPercent (double paddingPercent)
 Sets the minimum padding in percent length to be maintained between the edges of the target frame and image. More...
 
double getMinFillFraction ()
 Gets the minimum fill area as a fraction of the target frame. More...
 
void setMinFillFraction (double minFillFraction)
 Sets the minimum fill area as a fraction of the target frame. More...
 
double getMaxFillFraction ()
 Gets the maximum fill area as a fraction of the target frame. More...
 
void setMaxFillFraction (double maxFillFraction)
 Sets the maximum fill area as a fraction of the target frame. More...
 
double getMaxSkewAngle ()
 Gets the maximum angle the document can be rotated off from the target frame. More...
 
void setMaxSkewAngle (double maxSkewAngle)
 Sets the maximum angle the document can be rotated off from the target frame. More...
 
double getToleranceFraction ()
 Gets the maximum distance the document can be shifted from the target frame. More...
 
void setToleranceFraction (double toleranceFraction)
 Sets the maximum distance the document can be shifted from the target frame. More...
 

Protected Member Functions

 DetectionSettings ()
 Default constructor creates a detection setting object that has default values. More...
 
 DetectionSettings (DetectionSettings settings)
 

Detailed Description

A base class for configuration objects for controlling the guided detection driven by target frame.

The primary purpose of the settings object is to define properties of a rectangular target frame. The target frame is a rectangular area confined within the bounds of the image, and represents the the ideal area that should be covered by a document. Results returned from the document detector will provide adjustment guidance relative to the target frame.

A target frame is constructed from a center point, an aspect ratio, and a minimum edge padding. The size of the target frame is the largest possible rectangle that can be made without violating any of these constraints.

Additional settings properties set tolerances on the guidance available from a result object.

Constructor & Destructor Documentation

DetectionSettings ( )
protected

Default constructor creates a detection setting object that has default values.

  • Center Point: null
  • Aspect Ratio: 0
  • Padding: 5
  • minFillFraction: 0.65
  • maxFillFraction: 1.3
  • maxSkewAngle: 10
  • toleranceFraction: 0.15
DetectionSettings ( DetectionSettings  settings)
protected

Copy constructor

Parameters
settingsthe settings object to copy from
DetectionSettings ( Point  targetFrameCenter,
double  targetFrameAspectRatio,
double  targetFramePaddingPercent 
)

Constructor creates a document detection setting object that has specified values.

Parameters
targetFrameCenterSet the target rectangle center point. Should just be a point with in the bounds of the image height and width.
targetFrameAspectRatioSet the aspect ratio the target rectangle should have. Must be greater than 0.
targetFramePaddingPercentSet the padding around the target rectangle. must be greater than or equal to 0 and less then 100.

Member Function Documentation

Point getCenterPoint ( )

Gets the center point within the image of the target frame.

Returns
Point
See also
setCenterPoint(android.graphics.Point)
double getMaxFillFraction ( )

Gets the maximum fill area as a fraction of the target frame.

Returns
double
See also
setMaxFillFraction(double)
double getMaxSkewAngle ( )

Gets the maximum angle the document can be rotated off from the target frame.

Returns
double
See also
setMaxSkewAngle(double)
double getMinFillFraction ( )

Gets the minimum fill area as a fraction of the target frame.

Returns
double
See also
setMinFillFraction(double)
double getTargetFrameAspectRatio ( )

Gets the aspect ratio of the rectangular frame that should match the document being searched.

Returns
double
See also
setTargetFrameAspectRatio(double)
double getTargetFramePaddingPercent ( )

Gets the minimum padding in percent length to be maintained between the edges of the target frame and image.

Returns
double
See also
setTargetFramePaddingPercent(double)
double getToleranceFraction ( )

Gets the maximum distance the document can be shifted from the target frame.

Returns
double
See also
setToleranceFraction(double)
void setCenterPoint ( Point  targetFrameCenter)

Sets the center point within the image of the target frame.

The center point is any point within the image that the target frame will be constructed around and centered over. This value will be clamped to the valid area of the image being searched, and by default is set to the center of the image.

Parameters
targetFrameCenter: Point
void setMaxFillFraction ( double  maxFillFraction)

Sets the maximum fill area as a fraction of the target frame.

The maximum fill fraction puts an upper bound on what is considered an acceptable zoom level. If the area of a detected document is greater then the area of the target frame multiplied by the maximum fill fraction, guidance will suggest zooming out from the document. Setting a negative number is ignored.

The default value is 1.3.

void setMaxSkewAngle ( double  maxSkewAngle)

Sets the maximum angle the document can be rotated off from the target frame.

The skew angle tolerance puts an upper bound on how far a document can be rotated clockwise or counter-clockwise relative to the target frame and still be considered acceptable. Angles of rotation greater than the tolerance will result in guidance to turn the document. Setting a negative number is ignored.

The default value is 10, specified in degrees.

Parameters
maxSkewAngle: double
void setMinFillFraction ( double  minFillFraction)

Sets the minimum fill area as a fraction of the target frame.

The minimum fill fraction puts a lower bound on what is considered an acceptable zoom level. If the area of a detected document is less then the area of the target frame multiplied by the minimum fill fraction, guidance will suggest zooming in on the document. Setting a negative number is ignored.

The default value is 0.65.

Parameters
minFillFraction: double
void setTargetFrameAspectRatio ( double  targetFrameAspectRatio)

Sets the aspect ratio of the rectangular frame that should match the document being searched.

The aspect ratio is used to construct the target frame that should match the document being searched. If targetFrameAspectRatio > 1, the long edge of the target frame will align with the long edge of the camera preview. If 0 < targetFrameAspectRatio < 1, the long edge of the target frame will align with the short edge of the camera preview.

If the targetFrameAspectRatio is set to 0, then it will be automatically reset to an image aspect ratio.
Setting negative values has the same effect as if 0 was set.

The default value is 0.

Parameters
targetFrameAspectRatio: double
void setTargetFramePaddingPercent ( double  paddingPercent)

Sets the minimum padding in percent length to be maintained between the edges of the target frame and image.

Values will be clamped to the range [0-50]. The default value is 5. Also, note that there is a much lower operational bound to what the padding percent could be set to behave well. For example:

  • Given detection settings with a frame center at the center of the image, and a personal check aspect ratio, the constructed frame will fill the width of the image, leaving a space on the left and right equal to the padding percent of the image width.
  • Given detection settings with a frame center shifted to the left of the image center, the gap on the right side of the constructed frame will exceed the gap on the left.
Parameters
paddingPercent: double
void setToleranceFraction ( double  toleranceFraction)

Sets the maximum distance the document can be shifted from the target frame.

The movement tolerance puts an upper bound on how far a document can be shifted from the target frame and still be considered acceptable. The tolerance is specified as a fraction of the target size, and the comparison is made between the center of the target frame and the center of the detected document bounds. Setting a negative number is ignored.

The default tolerance value is 0.15.

Parameters
toleranceFraction: double

The documentation for this class was generated from the following file:
Untitled Document © 2018 Kofax, Inc. All rights reserved. Use is subject to license terms.