-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Description
BlinkIDAnalyzer file add custom method
/// Processes a image for document analysis.
/// - Parameter image: The image to analyze
public func analyzeByImage(image: UIImage) async {
guard !paused else { return }
if timerTask == nil {
startTimer(stepTimeoutDuration)
}
let inputImage = InputImage(uiImage: image)
let frameProcessResult = await session.process(inputImage: inputImage)
if let classInfo = frameProcessResult.processResult?.inputImageAnalysisResult.documentClassInfo,
let filter = classFilter {
if !filter.classAllowed(classInfo: classInfo) {
/// - Note: scanInterrupted returns alert type in continuation which results in presenting an alert.
/// Presening an alert results in paused scanning, which is resumed and reset on alert dismiss.
/// (4.3.2025. Toni Kreso)
scanInterrupted(with: .disallowedClass)
return
}
}
let events = translator.translate(frameProcessResult: frameProcessResult, session: session)
if events.contains(.requestDocumentSide(side: .back)) {
timerTask?.cancel()
}
print("events ==> \(events)")
if frameProcessResult.processResult?.resultCompleteness.scanningStatus == .documentScanned {
guard !scanningDone else { return }
scanningDone = true
Task { @ProcessingActor in
let sessionResult = session.getResult()
await finishScanning(with: .completed(sessionResult))
}
}
}
let settings = BlinkIDSdkSettings(licenseKey: licenseKey, helloLogEnabled: true)
let sdkInstance = try await BlinkIDSdk.createBlinkIDSdk(withSettings: settings)
let croppedImageSettings = CroppedImageSettings(returnDocumentImage: false, returnFaceImage: false)
let scanningSettings = ScanningSettings(croppedImageSettings: croppedImageSettings)
let blinkIdSessionSettings = BlinkIDSessionSettings(inputImageSource: .photo,
scanningMode: .single,
scanningSettings: scanningSettings,
stepTimeoutDuration: 5)
analyzer = try? await BlinkIDAnalyzer(sdk: sdkInstance,
blinkIdSessionSettings: blinkIdSessionSettings,
eventStream: BlinkIDEventStream())
await analyzer?.analyzeByImage(image: image)
let result = await analyzer?.result()
I choose an ID image from the album, customize the method, and parse the data with the image. The data returned by the process method of Blink IDSession always shows a non-successful (Deticestatus) state. Now image recognition is not supported?
Previous 6.13.0 can use image analysis, now 7.1.0 does not support image recognition?
Metadata
Metadata
Assignees
Labels
No labels