Skip to content

Creates an input image from a UIImage, BlinkIDSession work always failed #437

@robin2005

Description

@robin2005

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()

Image - 1
Image
Image

Image - 2
Image

Image

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions