Live Text

RSS for tag

Enable text interactions, translation, data detection, and QR code scanning within any image view on iOS, iPadOS, or macOS.

Posts under Live Text tag

10 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Specific barcode not recognized
I faced a problem during development that I could not scan Code39 barcode with iPad using Vision. A sample label I used for test has multiple Code39 barcode on it and I could scan almost all barcodes except for specific one. And when I use conventional barcode scanner and free apps to scan barcode, I could scan the barcode with no problem. I failed to scan the barcode only when I use Vision function. Has anyone faced similar situation? Do you know the cause why specific barcode could not be scanned with iPad with Vision?
0
0
155
4w
Specific barcode is not recognized
Hi, I face a problem that I could not scan a specific Code 39 barcode with Vision framework. We have multiple barcode in a label and almost all Code 39 can be scanned, but not for specific one. One more information, regardless the one that is not recognized with Vision can be read by a general barcode scanner. Have anyone faced similar situation? Is there unique condition to make it hard to scan the barcode when using Vision?(size, intensity, etc) Regards,
0
0
159
4w
QR codes on visionOS
Our app needs to scan QR codes (or a similar mechanism) to populate it with content the user wants to see. Is there any update on QR code scanning availability on this platform? I asked this before, but never got any feedback. I know that there is no way to access the camera (which is an issue in itself), but at least the system could provide an API to scan codes. (It would be also cool if we were able to use the same codes Vision Pro uses for detecting the Zeiss glasses, as long as we could create these via server-side JavaScript code.)
2
0
262
3w
Simple barcode reader. Please help
Hello everyone, first let me say a few words about myself. I am an IT student and I want to learn and develop some applications in Swift. Now I am working on one application and I need a barcode scanner to complete it. So I need help from someone who can help me with a simple barcode scanner. My idea is that the barcode will be on one screen and they have to read the code and write it to a variable. That's my idea. I will appreciate the full code or help. thank you for answer
2
0
569
Jan ’24
Delegate methods of ImageAnalysisInteractionDelegate don't fire
I have a live text implementation on the following LiveTextImageView. However, after the view loads and the analyze code is run, none of the delegate methods fire when I interact with the Live View. Selecting text does not fire the textSelectionDidChange method, nor does highlightSelectedItemsDidChange fire when the live text button in the bottom right is pressed. I tried a few different implementations, including an approach where the delegate was defined on a separate class. I am running this on a iPhone 12 Pro I recently updated to 17.0.3. My goal is to be able to provide additional options to the user beyond the default live-text overlay options, after identifying when they have finished selecting text. // // LiveTextImageView.swift // import UIKit import SwiftUI import VisionKit class ImageAnalyzerWrapper { static let shared = ImageAnalyzer() private init() { } } struct LiveTextImageViewRepresentable: UIViewRepresentable { var image: UIImage func makeUIView(context: Context) -> LiveTextImageView { return LiveTextImageView(image: image) } func updateUIView(_ uiView: LiveTextImageView, context: Context) { } } class LiveTextImageView: UIImageView, ImageAnalysisInteractionDelegate, UIGestureRecognizerDelegate { var capturedSelectedText: String? let analyzer = ImageAnalyzerWrapper.shared let interaction = ImageAnalysisInteraction() init(image: UIImage) { super.init(frame: .zero) self.image = image let photoWrapper = PhotoWrapper(rawPhoto: image) let resizedPhoto = photoWrapper.viewportWidthCroppedPhoto(padding: 40) self.image = resizedPhoto self.contentMode = .scaleAspectFit self.addInteraction(interaction) interaction.preferredInteractionTypes = [] interaction.analysis = nil analyzeImage() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } func analyzeImage() { if let image = self.image { Task { let configuration = ImageAnalyzer.Configuration([.text]) do { let analysis = try await analyzer.analyze(image, configuration: configuration) self.addInteraction(interaction) interaction.delegate = self interaction.analysis = analysis interaction.preferredInteractionTypes = .textSelection } catch { print("Error in live image handling") } } } } func interaction( _ interaction: ImageAnalysisInteraction, highlightSelectedItemsDidChange highlightSelectedItems: Bool) async { print("Highlighted items changed") } func interaction(_ interaction: ImageAnalysisInteraction, shouldBeginAt point: CGPoint, for interactionType: ImageAnalysisInteraction.InteractionTypes) async -> Bool { return interaction.hasInteractiveItem(at: point) || interaction.hasActiveTextSelection } func textSelectionDidChange(_ interaction: ImageAnalysisInteraction) async { print("Changed!") if #available(iOS 17.0, *) { capturedSelectedText = interaction.text print(capturedSelectedText ?? "") } } }
0
0
500
Oct ’23
QR Code Scanning: Safari loading previously scanned URL while using iPhone camera app
We are using URL encoded in QR code to open our web application. When user scans QR using the default Camera app on iPhone, upon clicking the link iOS opens the webpage on safari browser. Our URL looks like this "https://abc.com?qrdata=1", "https://abc.com?qrdata=2", "https://abc.com?qrdata=3". The URL query parameter(qrdata) differs for different process in the web app. So when so each QR code has same domain but different query parameters. If the user scans QR for https://abc.com?qrdata=1, the web page is opened on safari without any issue. If user scansQR for https://abc.com?qrdata=2 after the first QR code then for some reason on first attempt Safari is loading the previously scanned URL, in this case https://abc.com?qrdata=1. The change in query params is not received correctly by Safari. If we scan the new QR code twice then works on 2nd attempt to scan the QR. I can see from the history that the URL scanned is not the right url This is issue only on Safari iOS devices, on anyother browser works as expected.
0
0
939
Sep ’23
Got compile error while trying to process a rectangle type of detection instead of QR
I was switching the Detector scanner from QR to Rectangle type of detection but on Rectangle type of detection I cannot take the feature.messageString out of CIRectangleFeature, while on CIQRCodeFeature it works. Only what I had changed was ofType: CIDetectorTypeQRCode into CIDetectorTypeRectangle and features as? [CIQRCodeFeature] into features as? [CIRectangleFeature] here is the code func processQRCodeImage(_ image: UIImage) { var qrCodeLink = "" let detector: CIDetector = CIDetector(ofType: CIDetectorTypeRectangle, context: nil, options: [CIDetectorAccuracy: CIDetectorAccuracyHigh])! let ciImage: CIImage = CIImage(image: image)! let features = detector.features(in: ciImage) if let features = features as? [CIRectangleFeature] { for feature in features { qrCodeLink += feature.messageString! // Value of type 'CIRectangleFeature' has no member 'messageString' COMPILE ERROR } } if qrCodeLink.isEmpty { failedQRCoderead() } else { found(code: qrCodeLink) onBackPressed?() } }
0
0
441
Jul ’23