Image Frame Source

Defined in framework ScanditCaptureCore

ImageFrameSource
open class ImageFrameSource : NSObject, FrameSource

Added in version 6.3.0

To emit the frame set this object as the frame source for the DataCaptureContext and turn it on by changing the desired state to FrameSourceState.on.

Unless repeats is set, this frame source will turn off automatically after the frame is emitted.

Note

ScanIntention.smart has to observe a barcode across several frames before it returns it, so the mode settings must use ScanIntention.manual — unless repeats is true, which keeps the image coming and is enough for ScanIntention.smart to return a scan. Set the scan intention explicitly in that case, because an intention left at its default is switched to ScanIntention.manual for an image frame source.

Note

This frame source emits the same image, however many times it is emitted. To feed a continuous stream of frames from a camera your application owns, use SequenceFrameSource instead — see Sequence Frame Source.

init(image:)
convenience init(image: UIImage)

Added in version 6.3.0

Constructs a new ImageFrameSource from the provided UIImage.

The provided UIImage should have one of the following configuration:

Gray color space:

8 bits per pixel

8 bits per component

kCGImageAlphaNone

RGB color space:

32 bits per pixel

8 bits per component

kCGImageAlphaNoneSkipFirst

32 bits per pixel

8 bits per component

kCGImageAlphaNoneSkipLast

32 bits per pixel

8 bits per component

kCGImageAlphaPremultipliedFirst

32 bits per pixel

8 bits per component

kCGImageAlphaPremultipliedLast

repeats
open var repeats: Bool { get, set }

Added in version 8.6.0

Whether the frame source keeps re-emitting its frames after all of them have been processed. By default the frame source turns itself off once all frames have been emitted. Setting this to true gives the recognizer the repeated passes over the image that it generally needs, and is what makes ScanIntention.smart usable with a still image.

`switch`(toDesiredState:)
open func `switch`(toDesiredState state: FrameSourceState) async -> Bool

Added in version 6.3.0

Implemented from FrameSource. See FrameSource.`switch`(toDesiredState:completionHandler:).

`switch`(toDesiredState:)
open func `switch`(toDesiredState state: FrameSourceState) -> Void

Added in version 6.3.0

Convenience method for FrameSource.`switch`(toDesiredState:completionHandler:): it is same as calling FrameSource.`switch`(toDesiredState:completionHandler:) with the second argument set to nil.