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 Dart 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
.recognize
import 'dart:io';
import 'package:aspose_barcode_cloud/aspose_barcode_cloud.dart';
Configuration makeConfiguration() {
final jwtToken = Platform.environment['TEST_CONFIGURATION_ACCESS_TOKEN'];
if (jwtToken != null) {
return Configuration(accessToken: jwtToken);
} else {
return Configuration(
clientId: "Client Id from https://dashboard.aspose.cloud/applications",
clientSecret:
"Client Secret from https://dashboard.aspose.cloud/applications",
);
}
}
Future<void> main() async {
final config = makeConfiguration();
final recognizeApi = RecognizeApi(ApiClient(config));
final result = await recognizeApi.recognize(
DecodeBarcodeType.QR,
"https://products.aspose.app/barcode/scan/img/how-to/scan/step2.png",
recognitionMode: RecognitionMode.Fast,
recognitionImageKind: RecognitionImageKind.Photo,
);
print("File recognized, result: '${result.barcodes[0].barcodeValue}'");
}
recognizeBase64
import 'dart:convert';
import 'dart:io';
import 'package:aspose_barcode_cloud/aspose_barcode_cloud.dart';
Configuration makeConfiguration() {
final jwtToken = Platform.environment['TEST_CONFIGURATION_ACCESS_TOKEN'];
if (jwtToken != null) {
return Configuration(accessToken: jwtToken);
} else {
return Configuration(
clientId: "Client Id from https://dashboard.aspose.cloud/applications",
clientSecret:
"Client Secret from https://dashboard.aspose.cloud/applications",
);
}
}
Future<void> main() async {
final config = makeConfiguration();
final recognizeApi = RecognizeApi(ApiClient(config));
final fileName =
File("${Directory.current.path}${Platform.pathSeparator}Pdf417.png")
.absolute
.path;
final fileBytes = File(fileName).readAsBytesSync();
final imageBase64 = base64Encode(fileBytes);
final recognizeBase64Request = RecognizeBase64Request(
[DecodeBarcodeType.Pdf417],
imageBase64,
);
final BarcodeResponseList result =
await recognizeApi.recognizeBase64(recognizeBase64Request);
print(
"File '$fileName' recognized, result: '${result.barcodes[0].barcodeValue}'");
}
recognizeMultipart
import 'dart:io';
import 'package:aspose_barcode_cloud/aspose_barcode_cloud.dart';
Configuration makeConfiguration() {
final jwtToken = Platform.environment['TEST_CONFIGURATION_ACCESS_TOKEN'];
if (jwtToken != null) {
return Configuration(accessToken: jwtToken);
} else {
return Configuration(
clientId: "Client Id from https://dashboard.aspose.cloud/applications",
clientSecret:
"Client Secret from https://dashboard.aspose.cloud/applications",
);
}
}
Future<void> main() async {
final config = makeConfiguration();
final recognizeApi = RecognizeApi(ApiClient(config));
final file =
await File("${Directory.current.path}${Platform.pathSeparator}aztec.png")
.readAsBytes();
final BarcodeResponseList result =
await recognizeApi.recognizeMultipart(DecodeBarcodeType.Aztec, file);
print("File recognized, result: '${result.barcodes[0].barcodeValue}'");
}
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.