DMSVideoCaptureReader


@interface DMSVideoCaptureReader : DMSCaptureReader

The video capture reader interface is ideal for real time capture from an image source such as a camera. It vends a capture output that can be hooked to an existing AVFoundation capture tree. A video capture reader will automatically perform buffering and optimization necessary for a capture source. For situations in which a developer wants to have deeper control of how images are buffered or staged for detection, the synchronous image reader interface should be used.

  • Custom initializer for a new video capture reader for the given symbologies.

    Declaration

    Objective-C

    - (nullable id)
        initWithSymbologies:(DMSSymbologies)symbologies
                    options:(NSDictionary<DMSReaderOptionKey, id> *_Nonnull)options
                      error:(NSError *_Nullable *_Nullable)error;

    Swift

    init(symbologies: Symbologies, options: [ReaderOptionKey : Any] = [:]) throws

    Parameters

    symbologies

    The set of symbologies the reader should attempt to detect. This is defined by the DMSSymbology set. The ImageDigimarc detector must be in the list of provided detectors.

    options

    A dictionary of options for the reader.

    error

    An error returned by this function. Typically returned if a set of options is inconsistent, or if the current or supplied license key is invalid.

    Return Value

    Returns a new video capture reader. May return nil.

  • Designated initializer for a new video capture reader for the given symbologies.

    Declaration

    Objective-C

    - (nullable id)
        initWithSymbologies:(DMSSymbologies)symbologies
                    options:(NSDictionary<DMSReaderOptionKey, id> *_Nonnull)options
                     APIKey:(NSString *_Nullable)APIKey
                      error:(NSError *_Nullable *_Nullable)error;

    Swift

    init(symbologies: Symbologies, options: [ReaderOptionKey : Any] = [:], apiKey APIKey: String?) throws

    Parameters

    symbologies

    The set of symbologies the reader should attempt to detect. This is defined by the DMSSymbology set. The ImageDigimarc detector must be in the list of provided detectors.

    options

    A dictionary of options for the reader.

    APIKey

    Custom API key to use. Will override any other currently set API key.

    error

    An error returned by this function. Typically returned if a set of options is inconsistent, or if the current or supplied license key is invalid.

    Return Value

    Returns a new video capture reader. May return nil.

  • Sets the delegate to deliver results to.

    Declaration

    Objective-C

    - (void)setResultsDelegate:
                (nullable NSObject<DMSVideoCaptureReaderResultsDelegate> *)delegate
                         queue:(nullable dispatch_queue_t)queue;

    Swift

    func setResultsDelegate(_ delegate: VideoCaptureReaderResultsDelegate?, queue: DispatchQueue?)

    Parameters

    delegate

    A delegate to deliver results to.

    queue

    The queue to return results onto. Applications that need to do UI tasks in response to a detection may want to pass the main queue. If delegate is not nil, passing nil for this argument will cause an exception. If delegate is nil, this argument may be ignored.

  • Returns the results delegate. Will be nil if a delegate has not been set.

    Declaration

    Objective-C

    @property (weak, readonly, nullable) NSObject<DMSVideoCaptureReaderResultsDelegate> *resultsDelegate;

    Swift

    weak var resultsDelegate: VideoCaptureReaderResultsDelegate? { get }
  • Returns the queue results will be delivered on. Will be nil if a queue has not been set.

    Declaration

    Objective-C

    @property (readonly, nullable) dispatch_queue_t resultsQueue;

    Swift

    var resultsQueue: DispatchQueue? { get }
  • Limits the detection area to a specific region. rectOfInterest is a normalized value that defines the region of interest between 0..1 for both the height and the width of the image. This rect interoperates with AVFoundation’s rectOfInterest class of functions for converting between real pixel values and normalized values.

    Declaration

    Objective-C

    @property CGRect rectOfInterest;

    Swift

    var rectOfInterest: CGRect { get set }
  • The symbologies to use for detection

    Declaration

    Objective-C

    @property (readonly) DMSSymbologies symbologies;

    Swift

    var symbologies: Symbologies { get }
  • Sets symbologies and reader options.

    Declaration

    Objective-C

    - (BOOL)setSymbologies:(DMSSymbologies)symbologies
                   options:(nonnull NSDictionary<DMSReaderOptionKey, id> *)options
                     error:(NSError *_Nullable *_Nullable)error;

    Swift

    func setSymbologies(_ symbologies: Symbologies, options: [ReaderOptionKey : Any] = [:]) throws

    Parameters

    symbologies

    Symbologies to configure the reader to detect. The ImageDigimarc detector must be in the list of provided detectors.

    options

    Options to configure the reader with.

  • Resets the reader to its default state. Any previously detected payloads will be reported as new payloads again.

    Declaration

    Objective-C

    - (void)reset;

    Swift

    func reset()
  • If set to YES, the video capture reader will automatically apply the best capture settings for the current host to the AVCaptureDevice. Settings are applied either after this property is set to YES, or when the capture output vended by video capture reader is attached to an input device. The capture device settings may be altered multiple times. Defaults to YES.

    Declaration

    Objective-C

    @property BOOL automaticallyApplyBestCameraSettings;

    Swift

    var automaticallyApplyBestCameraSettings: Bool { get set }
  • A Boolean that allows the capture reader to automatically adjust the focus point of the camera. Defaults to true. Set to false to allow the focus point to be controlled manually.

    Declaration

    Objective-C

    @property BOOL automaticallyAdjustFocusPoint;

    Swift

    var automaticallyAdjustFocusPoint: Bool { get set }
  • The Metal device that will be used for acceleration. If nil, only the CPU will be used. This will be automatically populated with the most ideal device, if present. If you want to use a different Metal device, or disable Metal completely, this device can be changed through the setDevice:error: function.

    Declaration

    Objective-C

    @property (readonly, nullable) id<MTLDevice> device;

    Swift

    var device: MTLDevice? { get }
  • Sets the Metal device used for acceleration. An image reader can optionally use Metal for some, but not all, of the operations it executes. The use of Metal may be changed or expanded in the future.

    Declaration

    Objective-C

    - (BOOL)setDevice:(id<MTLDevice> _Nullable)device
                error:(NSError *_Nullable *_Nullable)error;

    Swift

    func setDevice(_ device: MTLDevice?) throws

    Parameters

    device

    The device to use for Metal acceleration. Can be nil, in which case Metal will be disabled. When Metal is disabled, the image reader will use a CPU path.

    error

    Error value if the Metal device could not be set. Examples of this include if the device is not capable, or the OS is not compatible. Notably some devices like the iPhone 5S, and some OS versions like iOS 10 are not supported for Metal. If an error occurs, the developer might want to pick a different Metal device, or do nothing and allow DMSDK to pick the best strategy. As a gemeral rule, any device that is compatible with Metal Performance Shaders should work. But this support may change in the future, and there are other factors that will currently determine if a device is compatible.