Processing Multiple Images/Pages
| Method | Description |
|---|---|
setInput |
Sets up an image source to provide images for continuous processing. |
getInput |
Returns the image source object. |
addResultReceiver |
Adds a CapturedResultReceiver object as the receiver of captured results. |
removeResultReceiver |
Removes the specified CapturedResultReceiver object. |
removeAllResultReceivers |
Removes all user-added CapturedResultReceivers. |
startCapturing |
Initiates a capturing process based on a specified template. This process is repeated for each image fetched from the source. |
stopCapturing |
Stops the capturing process. |
pauseCapturing |
Pauses the Capture Vision Router. |
resumeCapturing |
Resumes the Capture Vision Router. |
addCaptureStateListener |
Registers a CaptureStateListener to be used as a callback when capture state is received. |
removeCaptureStateListener |
Removes a CaptureStateListener that has been configured for the Capture Vision Router. |
removeAllCaptureStateListeners |
Removes all user-added CaptureStateListeners. |
addResultFilter |
Adds a CapturedResultFilter object to filter non-essential results. |
removeResultFilter |
Removes the specified CapturedResultFilter object. |
removeAllResultFilters |
Removes all user-added CapturedResultFilters. |
addImageSourceStateListener |
Register a ImageSourceStateListener to get callback when the status of ImageSourceAdapter received. |
removeImageSourceStateListener |
Removes a ImageSourceStateListener from the Capture Vision Router. |
removeAllImageSourceStateListeners |
Removes all user-added ImageSourceStateListeners. |
switchCapturingTemplate |
Switch the image processing settings with the CaptureVisionTemplate name during the image processing workflow. |
setInput
Sets an image source that will provide images to be consecutively processed.
- Objective-C
- Swift
- (BOOL)setInput:(nullable DSImageSourceAdapter *)adapter error:(NSError * _Nullable * _Nullable)error;func setInput(_ adapter: ImageSourceAdapter) throws -> BOOL
Parameters
adapter: An object of DSImageSourceAdapter. You can use an internally implemented ImageSourceAdapter such as CameraEnhancer, DirectoryFetcher or FileFetcher.
error: An NSError pointer. If an error occurs, it will represent the error information.
Error
| Error Code | Value | Description |
|---|---|---|
| EC_CALL_REJECTED_WHEN_CAPTURING | -10062 | Function call is rejected when capturing in progress. |
Return Value
A BOOL value that indicates whether the input is set successfully.
getInput
Gets the attached image source adapter (DSImageSourceAdapter) object of the Capture Vision Router.
- Objective-C
- Swift
- (nullable DSImageSourceAdapter *)getInput;func getInput() -> ImageSourceAdapter
Return Value
The attached DSImageSourceAdapter object of the capture vision router.
addImageSourceStateListener
Registers a DSImageSourceStateListener object to be used as a callback when the status of DSImageSourceAdapter is received.
- Objective-C
- Swift
- (void)addImageSourceStateListener:(id<DSImageSourceStateListener>)listener;func addImageSourceStateListener(_ listener:ImageSourceStateListener)
Parameters
listener: An object of DSImageSourceStateListener.
removeImageSourceStateListener
Removes a DSImageSourceStateListener from the Capture Vision Router.
- Objective-C
- Swift
- (void)removeImageSourceStateListener:(id<DSImageSourceStateListener>)listener;func removeImageSourceStateListener(_ listener:ImageSourceStateListener)
Parameters
listener: An object of DSImageSourceStateListener.
removeAllImageSourceStateListeners
Removes all user-added DSImageSourceStateListeners.
- Objective-C
- Swift
- (void)removeAllImageSourceStateListeners;func removeAllImageSourceStateListeners()
addResultReceiver
Adds a CapturedResultReceiver object as the receiver of captured results.
- Objective-C
- Swift
- (void)addResultReceiver:(id<DSCapturedResultReceiver>)receiver;func addResultReceiver(_ listener:CapturedResultReceiver)
Parameters
listener: An object of DSCapturedResultReceiver.
removeResultReceiver
Removes the specified CapturedResultReceiver object.
- Objective-C
- Swift
- (void)removeResultReceiver:(id<DSCapturedResultReceiver>)receiver;func removeResultReceiver(_ listener:CapturedResultReceiver)
Parameters
listener: An object of DSCapturedResultReceiver.
Return Value
A BOOL value that indicates whether the result receiver is removed successfully.
removeAllResultReceivers
Removes all user-added CapturedResultReceivers.
- Objective-C
- Swift
- (void)removeAllResultReceivers;func removeAllResultReceivers()
startCapturing
Initiates a capturing process based on a specified template. This process is repeated for each image fetched from the source.
- Objective-C
- Swift
- (void)startCapturing:(NSString*)templateName completionHandler:(nullable void(^)(BOOL isSuccess, NSError *_Nullable error))completionHandler;func startCapturing(_ templateName:String, completionHandler: ((Bool, (any Error)?) -> Void)? = nil)
Parameters
templateName: Specifies a “CaptureVisionTemplate” to use. The following value are available for this parameter:
- One of the
DSPresetTemplatemember. This is available only if you have never upload a new template viainitSettingsorinitSettingsFromFile. - A string that represents one of the template name that you have uploaded via
initSettingsorinitSettingsFromFile. - ”” (empty string) to use the default template. The first template will be used if you have uploaded a template file via
initSettingsFromFileorinitSettings.
completionHandler: A completion handler the system calls after it finishes the startCapturing.
- isSuccess: A BOOL value that indicates whether the startCapturing operation is successful.
- error: An error object if the request fails; otherwise, nil.
Error
| Error Code | Value | Description |
|---|---|---|
| EC_TEMPLATE_NAME_INVALID | -10036 | The target template name is invalid. |
| EC_CALL_REJECTED_WHEN_CAPTURING | -10062 | Function call is rejected when capturing in progress. |
| EC_NO_IMAGE_SOURCE | -10063 | Can not start capturing before you set the input. |
Return Value
A BOOL value that indicates whether the capture starts successfully.
stopCapturing
Stops the capturing process.
- Objective-C
- Swift
- (void)stopCapturing;func stopCapturing()
pauseCapturing
Pauses the capturing process.
- Objective-C
- Swift
- (void)pauseCapturing;func pauseCapturing()
resumeCapturing
Resumes the capturing process.
- Objective-C
- Swift
- (void)resumeCapturing;func resumeCapturing()
addCaptureStateListener
Registers a DSCaptureStateListener to be used as a callback when capture state changes.
- Objective-C
- Swift
- (void)addCaptureStateListener:(nonnull id<DSCaptureStateListener>)listener;func addCaptureStateListener(_ listener:CaptureStateListener)
Parameters
listener: A delegate object of DSCaptureStateListener to receive the capture state.
Return Value
A BOOL value that indicates whether the capture state listener is added successfully.
removeCaptureStateListener
Removes a DSCaptureStateListener that has been configured for the Capture Vision Router via the addCaptureStateListener method.
- Objective-C
- Swift
- (void)removeCaptureStateListener:(nonnull id<DSCaptureStateListener>)listener;func removeCaptureStateListener(_ listener:CaptureStateListener)
Parameters
listener: An object of DSCaptureStateListener.
Return Value
A BOOL value that indicates whether the capture state listener is removed successfully.
removeAllCaptureStateListeners
Removes all user-added DSCaptureStateListeners.
- Objective-C
- Swift
- (void)removeAllCaptureStateListeners;func removeAllCaptureStateListeners()
addResultFilter
Adds a DSCapturedResultFilter object to filter non-essential results. Currnetly, is must be a MultiFrameCrossFilter object.
- Objective-C
- Swift
- (void)addResultFilter:(nonnull id<DSCapturedResultFilter>)filter;func addResultFilter(_ filter:CapturedResultFilter)
Parameters
filter: An object of DSCapturedResultFilter.
Return Value
A BOOL value that indicates whether the result filter is added successfully.
removeResultFilter
Removes the specified DSCapturedResultFilter object.
- Objective-C
- Swift
- (void)removeResultFilter:(nonnull id<DSCapturedResultFilter>)filter;func removeResultFilter(_ filter:CapturedResultFilter)
Parameters
filter: An object of DSCapturedResultFilter.
Return Value
A BOOL value that indicates whether the result filter is removed successfully.
removeAllResultFilters
Removes all user-added DSCapturedResultFilters.
- Objective-C
- Swift
- (void)removeAllResultFilters;func removeAllResultFilters()
switchCapturingTemplate
Switch the image processing settings with the CaptureVisionTemplate name during the image processing workflow.
- Objective-C
- Swift
-(BOOL)switchCapturingTemplate:(NSString *)templateName error:(NSError * _Nullable * _Nullable)error;func switchCapturingTemplate(_ templateName:String) throws -> Bool
Parameters
templateName: The name of the new capturing template to apply.
error: An NSError pointer. If an error occurs, it will represent the error information.
Return Value
A BOOL value that indicates whether the capture starts successfully.
Remarks
- Introduced in Dynamsoft Barcode Reader SDK version 11.2.1000 and Dynamsoft Capture Vision version 3.2.1000.