Static Public Member Functions | |
static ScanAreaSettings | createDefaultPortraitSettings () |
static ScanAreaSettings | createDefaultLandscapeSettings () |
static ScanAreaSettings | createWithJson (JSONObject json) throws JSONParseException |
Public Attributes | |
int | squareCodeLocationConstraint |
int | wideCodeLocationConstraint |
RectF | squareCodeLocationArea |
RectF | wideCodeLocationArea |
RectF | searchArea |
int | primaryDirection |
Static Public Attributes | |
static final int | DIRECTION_VERTICAL |
static final int | DIRECTION_HORIZONTAL |
Detailed Description
Scanning area settings control where codes are to be searched in images/frames.
The areas as well as the hot-spot is specified in relative coordinates. The coordinates are rotated with the device: The top-left corner of the camera preview is 0,0, whereas 1,1 is the bottom-right corner. Coordinates specified outside of the supported range raise an exception.
For most use-cases, the "active scanning area portrait/active scanning area landscape" available as part of the ScanSettings is sufficient and is simpler to use. We only recommend to use the ScanAreaSettings if you have very specific needs for your application that can't be met with the "active scanning area" interface.
This class allows to control the areas separately for wide and square symbologies. Classification of symbologies into square and wide is according to their aspect ratio: symbologies that have a width/height ratio different from one (1d codes, PDF417, etc.) are classified as wide, symbologies whose width/height aspect ratio is close to 1.0 (QR, Aztec etc.) are classified as square. Symbologies whose aspect ratio can vary, e.g. DataMatrix, or DataBar, are classified according to their pre-dominant aspect ratio.
- Note
- This interface is not part of the stable API yet and is subject to change. Functionality may disappear, or change in future releases.
- Since
- 5.0
Member Function Documentation
|
static |
Create new default settings for portrait scanning.
- Returns
- A new scan area settings instance
- Since
- 5.0
|
static |
Create new default settings for landscape scanning.
- Returns
- A new scan area settings instance
- Since
- 5.0
|
static |
Create scan area settings from a JSON object.
- Parameters
-
json the JSON object. The following keys are understood: wideCodeLocationArea
andsquareCodeLocationArea
can be used to specify the code location area rectangles. The rectangles can either be objects withx
,y
,width
andheight
key-value pairs, or a list of four floating-point values ordered as [x, y, width, height].squareCodeLocationConstraint
andwideCodeLocationConstraint
can be used to set the the respective constraint for the areas. The stringsrestrict
andhint
are mapped to their enum counter-part.primaryDirection
can either be set tovertical
orhorizontal
to specify the primary direction for scanning. Additional keys are ignored. Keys which are not set are left as default values.
- Returns
- The scan area settings.
- Exceptions
-
JSONParseException in case any of the provided values is not well-formed.
- Since
- 5.1.0
Member Data Documentation
|
static |
Vertical direction.
- Since
- 5.1.0
|
static |
Horizontal direction.
- Since
- 5.1.0
int squareCodeLocationConstraint |
The code location constraint to be used for square codes.
- Since
- 5.0
int wideCodeLocationConstraint |
The code location constraint to be used for wide codes.
- Since
- 5.0
RectF squareCodeLocationArea |
The code location area to be used for square codes.
Depending on squareCodeLocationConstraint, square codes are either only recognized, or given preference in this area.
- Since
- 5.0
RectF wideCodeLocationArea |
The code location area to be used for wide codes.
Depending on wideCodeLocationConstraint, square codes are either only recognized, or given preference in this area.
- Since
- 5.0
RectF searchArea |
The area in which codes are searched.
When the code location constraint it set to CODE_LOCATION_RESTRICT this area is ignored.
- Since
- 5.0
int primaryDirection |
The primary direction to be used for scanning.
The primary direction for scanning. By default, preference is given to codes in horizontal direction. Change this to DIRECTION_VERTICAL to optimize the engine for scanning vertical codes. This only influences recognition of wide codes and has no influence on square codes.
- Since
- 5.1.0
The documentation for this class was generated from the following file:
- ScanAreaSettings.java