Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
When working with barcodes in applications, optimizing recognition quality and speed is essential. The RecognitionMode setting in the Aspose.BarCode.Cloud SDK for Swift offers a way to adjust these parameters, making it possible to prioritize either quality or speed during barcode recognition.
The RecognitionMode parameter can be set to the following values to control the recognition process:
The RecognizeAPI interface provides methods to recognize barcodes from files using different HTTP request types. Below are the available methods:
recognize: Recognizes barcode from a file on the server using a GET request.recognizeBase64: Recognizes barcode from a file provided in the request body using a POST request with JSON or XML format.recognizeMultipart: Recognizes barcode from a file provided in the request body using a POST request with multipart/form-data.recognizeimport AsposeBarcodeCloud
import Foundation
let client = AsposeBarcodeCloudClient(
clientId: "Client Id from https://dashboard.aspose.cloud/applications",
clientSecret: "Client Secret from https://dashboard.aspose.cloud/applications"
)
let barcodeImageURL =
ProcessInfo.processInfo.environment["TEST_CONFIGURATION_BARCODE_IMAGE_URL"]
?? "https://raw.githubusercontent.com/aspose-barcode-cloud/Aspose.BarCode-Cloud-SDK-for-Swift/main/testdata/QR_and_Code128.png"
let response = try await RecognizeAPI.recognize(
barcodeType: .qr,
fileUrl: barcodeImageURL,
recognitionMode: .excellent,
apiConfiguration: client.apiConfiguration
)
print(response.barcodes?.first?.barcodeValue ?? "No barcode found")
recognizeBase64import AsposeBarcodeCloud
import Foundation
let client = AsposeBarcodeCloudClient(
clientId: "Client Id from https://dashboard.aspose.cloud/applications",
clientSecret: "Client Secret from https://dashboard.aspose.cloud/applications"
)
let imageData = try Data(contentsOf: URL(fileURLWithPath: "barcode.png"))
let request = RecognizeBase64Request(
barcodeTypes: [.qr],
fileBase64: imageData.base64EncodedString(),
recognitionMode: .excellent
)
let response = try await RecognizeAPI.recognizeBase64(
recognizeBase64Request: request,
apiConfiguration: client.apiConfiguration
)
print(response.barcodes?.first?.barcodeValue ?? "No barcode found")
recognizeMultipartimport AsposeBarcodeCloud
import Foundation
let client = AsposeBarcodeCloudClient(
clientId: "Client Id from https://dashboard.aspose.cloud/applications",
clientSecret: "Client Secret from https://dashboard.aspose.cloud/applications"
)
let imageData = try Data(contentsOf: URL(fileURLWithPath: "qr.png"))
let response = try await RecognizeAPI.recognizeMultipart(
barcodeType: .qr,
file: imageData,
recognitionMode: .excellent,
apiConfiguration: client.apiConfiguration
)
print(response.barcodes?.first?.barcodeValue ?? "No barcode found")
Choosing the appropriate RecognitionMode is essential in tailoring barcode recognition to the specific needs of your application. Whether prioritizing speed or accuracy, the examples provided demonstrate how to use the RecognizeAPI interface to adjust settings for optimal performance. By fine-tuning RecognitionMode and RecognitionImageKind, you can enhance both efficiency and accuracy, making your barcode processing solution robust across various use cases.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.