SBSScanAreaSettings Class Reference

Inherits NSObject.

Class Methods

(nonnull instancetype) + defaultPortraitSettings
 
(nonnull instancetype) + defaultLandscapeSettings
 
(nullable instancetype) + settingsWithDictionary:error:
 

Properties

CGRect searchArea
 
CGRect wideCodesLocationArea
 
SBSCodeLocationConstraint wideCodesLocationConstraint
 
CGRect squareCodesLocationArea
 
SBSCodeLocationConstraint squareCodesLocationConstraint
 
SBSDirection primaryDirection
 

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 SBSScanSettings is sufficient and is simpler to use. We only recommend to use the SBSScanAreaSettings 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 dissappear, or change in future releases.
Since
5.0

Method Documentation

+ (nonnull instancetype) defaultPortraitSettings

Returns a new instance with default settings for portrait scanning.

Since
5.0
+ (nonnull instancetype) defaultLandscapeSettings

Returns a new instance with default settings for landscape scanning.

Since
5.0
+ (nullable instancetype) settingsWithDictionary: (nonnull NSDictionary< NSString *, id > *)  dict
error: (NSError *_Nullable *_Nullable)  error 

Create scan area settings from a JSON object.

Parameters
dictthe JSON object. The following keys are understood: wideCodeLocationArea and squareCodeLocationArea can be used to specify the code location area rectangles. The rectangles can either be objects with x, y, width and height key-value pairs, or a list of four floating-point values ordered as [x, y, width, height]. squareCodeLocationConstraint and wideCodeLocationConstraint can be used to set the the respective constraint for the areas. The strings restrict and hint are mapped to their enum counter-part. primaryDirection can either be set to vertical or horizontal to specify the primary direction for scanning. Additional keys are ignored. Keys which are not set are left as default values.
errorin case of an invalid JSON dictionary, error will contain more details on the error.
Returns
The scan area settings, or null if it could not be parsed.
Since
5.1.0

Property Documentation

- (CGRect) searchArea
readwritenonatomicassign

The area in which codes are searched.

By default, codes are searched in the whole image.

Since
5.0
- (CGRect) wideCodesLocationArea
readwritenonatomicassign

Code location area for wide codes.

Since
5.0
- (SBSCodeLocationConstraint) wideCodesLocationConstraint
readwritenonatomicassign

Code location constraint for wide codes.

Since
5.0
- (CGRect) squareCodesLocationArea
readwritenonatomicassign

Code location area for square codes.

Since
5.0
- (SBSCodeLocationConstraint) squareCodesLocationConstraint
readwritenonatomicassign

Code location constraint for square codes.

Since
5.0
- (SBSDirection) primaryDirection
readwritenonatomicassign

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 SBSDirectionVertical to optimize the engine for scanning vertical codes. This only incluences recognition of wide codes and has no influence on square codes.

Since
5.1

The documentation for this class was generated from the following file: