diff --git a/_data/product_version.yml b/_data/product_version.yml index 1b8c0a1..dc1cd7d 100644 --- a/_data/product_version.yml +++ b/_data/product_version.yml @@ -24,6 +24,7 @@ version_info_list: - 2.2.0_c - 2.0.0_c - 2.0.0_dotnet + - 2.2.10_java - 2.0.0_java - value: 1.x child: diff --git a/programming-old/java/api-reference/dlr-runtime-settings-v2.0.0.md b/programming-old/java/api-reference/dlr-runtime-settings-v2.0.0.md new file mode 100644 index 0000000..8345515 --- /dev/null +++ b/programming-old/java/api-reference/dlr-runtime-settings-v2.0.0.md @@ -0,0 +1,132 @@ +--- +layout: default-layout +title: Class DLRRuntimeSettings - Dynamsoft Label Recognizer Java Edition +description: This page shows the DLRRuntimeSettings struct of Dynamsoft Label Recognizer for Java Language. +keywords: DLRRuntimeSettings, struct, java +needAutoGenerateSidebar: true +needGenerateH3Content: true +noTitleIndex: true +permalink: /programming/java/api-reference/dlr-runtime-settings-v2.0.0.html +--- + + +# DLRRuntimeSettings +Defines a struct to configure the text recognizer runtime settings. These settings control the text recognition process. + +```java +class com.dynamsoft.dlr.DLRRuntimeSettings +``` + +## Attributes + +| Attribute | Type | +|---------- | ---- | +| [`maxThreadCount`](#maxthreadcount) | *int* | +| [`characterModelName`](#charactermodelname) | *String* | +| [`referenceRegion`](#referenceregion) | [`DLRReferenceRegion`](dlr-reference-region.md) | +| [`textArea`](#textarea) | [`DLRQuadrilateral`](dlr-quadrilateral.md) | +| [`dictionaryPath`](#dictionarypath) | *String* | +| [`dictionaryCorrectionThreshold`](#dictionarycorrectionthreshold) | [`DLRDictionaryCorrectionThreshold`](dlr-dictionary-correction-threshold.md) | +| [`binarizationModes`](#binarizationmodes) | *int\[\]* | +| [`furtherModes`](#furthermodes) | [`DLRFurtherModes`](dlr-further-modes.md)| + +  + +### maxThreadCount +Sets the number of threads the algorithm will use to recognize label. + +```java +int maxThreadCount +``` + +**Value Range** + +[1, 4] + +**Default value** + +4 + +**Remarks** + +To keep a balance between speed and quality, the library concurrently runs four different threads by default. + +  + +### characterModelName +The name of the CharacterModel. + +```java +String characterModelName +``` + +  + +### referenceRegion +Sets the reference region to search for text. + +```java +DLRReferenceRegion referenceRegion +``` + +  + +### textArea +Sets the text area relative to the reference region. + +```java +Quadrilateral textArea +``` + +  + +### dictionaryPath +Sets the path of the dictionary file. + +```java +String dictionaryPath +``` + +  + +### dictionaryCorrectionThreshold +Sets the threshold of dictionary error correction. + +```java +DLRDictionaryCorrectionThreshold dictionaryCorrectionThreshold +``` + + +  + +### binarizationModes +Sets the mode and priority for binarization. + +```java +int[] binarizationModes +``` + +**Value Range** + +Each array item can be any one of the [`EnumBinarizationMode`]({{ site.dlr_enumerations }}binarization-mode.html) Enumeration items. + +**Default value** + +`[EnumBinarizationMode.BM_LOCAL_BLOCK, EnumBinarizationMode.BM_SKIP, EnumBinarizationMode.BM_SKIP, EnumBinarizationMode.BM_SKIP, EnumBinarizationMode.BM_SKIP, EnumBinarizationMode.BM_SKIP, EnumBinarizationMode.BM_SKIP, EnumBinarizationMode.BM_SKIP]` + +**Remarks** + +The array index represents the priority of the item. The smaller index is, the higher priority is. + +  + +### furtherModes +Sets further modes. + +```java +DLRFurtherModes furtherModes +``` + +**See also** + +[`DLRFurtherModes`](dlr-further-modes.md) diff --git a/programming-old/java/api-reference/dlr-runtime-settings.md b/programming-old/java/api-reference/dlr-runtime-settings.md index 95b15bc..e172480 100644 --- a/programming-old/java/api-reference/dlr-runtime-settings.md +++ b/programming-old/java/api-reference/dlr-runtime-settings.md @@ -29,6 +29,7 @@ class com.dynamsoft.dlr.DLRRuntimeSettings | [`dictionaryCorrectionThreshold`](#dictionarycorrectionthreshold) | [`DLRDictionaryCorrectionThreshold`](dlr-dictionary-correction-threshold.md) | | [`binarizationModes`](#binarizationmodes) | *int\[\]* | | [`furtherModes`](#furthermodes) | [`DLRFurtherModes`](dlr-further-modes.md)| +| [`timeout`](#timeout) | *int* |   @@ -132,3 +133,21 @@ DLRFurtherModes furtherModes [`DLRFurtherModes`](dlr-further-modes.md) +  + +### timeout + +Sets the maximum amount of time (in milliseconds) that should be spent searching for labels per page. It does not include the time taken to load/decode an image (TIFF, PNG, etc.) from disk into memory. + +```cpp +int timeout +``` + +**Value Range** + [0, 0x7fffffff] + +**Default value** + 10000 + +**Remarks** + If you want to stop searching for labels after a certain period of time, you can use this parameter to set a timeout. diff --git a/programming-old/java/release-notes/index.md b/programming-old/java/release-notes/index.md index 55aeec9..f736f53 100644 --- a/programming-old/java/release-notes/index.md +++ b/programming-old/java/release-notes/index.md @@ -9,5 +9,6 @@ permalink: /programming/java/release-notes/index.html # Release Notes - Java +- [2.2.10 (06/27/2024)](java-2.md#2210-06272024) - [2.0 (08/26/2021)](java-2.md#20-08262021) - [1.2.1 (06/08/2021)](java-1.md#121-06082021) diff --git a/programming-old/java/release-notes/java-2.md b/programming-old/java/release-notes/java-2.md index 930be0d..0321c49 100644 --- a/programming-old/java/release-notes/java-2.md +++ b/programming-old/java/release-notes/java-2.md @@ -9,6 +9,28 @@ permalink: /programming/java/release-notes/java-2.html # Release Notes - Java 2.x +## 2.2.10 (06/27/2024) + +### Highlights + +{%- include release-notes/product-highlight-2.2.md -%} + +### Changelog + +#### New + +- Added a new property [`timeout`](../../java/api-reference/dlr-runtime-settings.md#timeout) to [`DLRRuntimeSettings`](../../java/api-reference/dlr-runtime-settings.md) class. +- Added modes parameter `CharacterNormalizationModes` to normalize the text. The parameter is available under the following classes: + - `LabelRecognizerParameter` + - `TextArea` + - `LineSpecification` + +#### Improved + +- Reduced the size of MRZ model from 10MB to 2.56MB. +- Improved single-line text confidence. This enables users to implement a result confidence filter to improve the recognition accuracy. +- Improved character segmentation when processing some connected characters. This improves the recognition accuracy. + ## 2.0 (08/26/2021) ### Highlights diff --git a/programming-old/java/user-guide-v2.0.0.md b/programming-old/java/user-guide-v2.0.0.md new file mode 100644 index 0000000..5b6920d --- /dev/null +++ b/programming-old/java/user-guide-v2.0.0.md @@ -0,0 +1,137 @@ +--- +layout: default-layout +title: Java User Guide - Dynamsoft Label Recognizer +description: This is the user guide page of Dynamsoft Label Recognizer for Java Language. +keywords: java, user guide +needAutoGenerateSidebar: true +needGenerateH3Content: true +permalink: /programming/java/user-guide-v2.0.0.html +--- + +# User Guide - Java + +- [User Guide - Java](#user-guide---java) + - [Requirements](#requirements) + - [Installation](#installation) + - [Build your First Application](#build-your-first-application) + - [Create a New Project](#create-a-new-project) + - [Include the Label Recognizer library](#include-the-label-recognizer-library) + - [Initialize the Label Recognizer](#initialize-the-label-recognizer) + - [Recognition Process and How to Use the Results](#recognition-process-and-how-to-use-the-results) + - [Build and Run the Project](#build-and-run-the-project) + +## Requirements + +- Operating systems: + - Windows 7, 8, 10 + - Windows Server 2003, 2008, 2008 R2, 2012 + - Linux x64 (Ubuntu 14.04.4+ LTS, Debian 8+, etc.) + - JDK 1.7 and above + +- Environment: Eclipse 3.7 and above. + +## Installation + +If you don't have SDK yet, please go to Dynamsoft website to get it. After the sdk is decompressed, the root directory of the DLR installation package is `DynamsoftLabelRecognizer`, which is represented by `[INSTALLATION FOLDER]`. + +## Build your First Application + +Let's start by creating a console application which demonstrates how to use the minimum code to recognize text from an image file. + +>You can download the similar complete source code from [Here](https://github.com/Dynamsoft/label-recognizer-java-samples/tree/master/samples/HelloWorld). + +### Create a New Project + +1. Open Eclipse. Go to File > New > Project, create a new Java project `DLRJavaSample`. + +2. Add a new Class named `DLRJavaSample` into the project. + +### Include the Label Recognizer library + +1. Add the Dynamsoft Label Recognizer JAR file to your project. + Click File > Properties > Java Build Path > Libraries > Add external JARs, add `dynamsoft-labelrecognizer-{version number}.jar` and `dynamsoft-core-{version number}.jar` click Apply. + >Note: The JAR file can be found at `[INSTALLATION FOLDER]\lib`. + +2. Import the package in the file `DLRJavaSample.java` + + ```java + import com.dynamsoft.dlr.*; + ``` + +### Initialize the Label Recognizer + +1. Initialize the license key + + ```java + // 1.Initialize license. + LabelRecognizer.initLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInByb2R1Y3RzIjoyfQ=="); + ``` + + >Note: + >- Network connection is required for the license to work. + >- "DLS2***" is a default free public trial license used in the sample. + >- You can request a 30-day trial license via the [Request a Trial License](https://www.dynamsoft.com/customer/license/trialLicense?product=dlr&utm_source=guide&package=java){:target="_blank"} link. + +2. Create an instance of Dynamsoft Label Recognizer + + ```java + // 2.Create an instance of Label Recognizer. + LabelRecognizer dlr = new LabelRecognizer(); + ``` + +### Recognition Process and How to Use the Results + +1. Recognizing text in an image + + ```java + DLRResult[] results = null; + + try { + results = dlr.recognizeByFile("../../SampleImages/dlr-sample-vin.png", ""); + } catch (LabelRecognizerException ex) { + ex.printStackTrace(); + } + ``` + + >You can download the image [dlr-sample-vin.png](../assets/dlr-sample-vin.png) for testing. In addition, you can replace it with the full path of the image you want to recognize. + >For the error handling mechanism, when an error occurs during the recognition process, an exception will be thrown. You should add codes for error handling based on your needs. Check out [Error Code]({{site.dlr_enumerations}}error-code.html) for full supported error codes. + +2. Get and output the recognition results + + ```java + if (results != null && results.length > 0) { + for (int i = 0; i < results.length; i++) { + + // Get result of each text area (also called label). + DLRResult result = results[i]; + System.out.println("Result " + i + ":"); + for (int j = 0; j < result.lineResults.length; j++) { + + // Get the result of each text line in the label. + DLRLineResult lineResult = result.lineResults[j]; + System.out.println(">>Line Result " + j + ": " + lineResult.text); + } + } + } else { + System.out.println("No data detected."); + } + ``` + + The recognition results of SDK are organized into a four-tier structure: + - `DLRResult[]` corresponds to the results of an `image` + - `DLRResult` corresponds to the result of a `TextArea` (also called Label) + - `DLRLineResult` corresponds to the result of each `TextLine` in the Label + - `DLRCharacterResult` corresponds to the result of each `Character` in the `TextLine` + + The structure is shown in the figure below: + +
+ DLR Result Structure +

Figure 1 – DLR Result Structure

+
+ +You can download the similar complete source code from [Here](https://github.com/Dynamsoft/label-recognizer-java-samples/tree/master/samples/HelloWorld). + +### Build and Run the Project + +1. Right click the project, click Run As > Java Application. diff --git a/programming-old/java/user-guide.md b/programming-old/java/user-guide.md index 2a76093..c38d590 100644 --- a/programming-old/java/user-guide.md +++ b/programming-old/java/user-guide.md @@ -16,6 +16,8 @@ permalink: /programming/java/user-guide.html - [Build your First Application](#build-your-first-application) - [Create a New Project](#create-a-new-project) - [Include the Label Recognizer library](#include-the-label-recognizer-library) + - [Option 1: Add the Libraries Manually](#option-1-add-the-libraries-manually) + - [Option 2: Add the Libraries via Maven](#option-2-add-the-libraries-via-maven) - [Initialize the Label Recognizer](#initialize-the-label-recognizer) - [Recognition Process and How to Use the Results](#recognition-process-and-how-to-use-the-results) - [Build and Run the Project](#build-and-run-the-project) @@ -40,7 +42,7 @@ Let's start by creating a console application which demonstrates how to use the >You can download the similar complete source code from [Here](https://github.com/Dynamsoft/label-recognizer-java-samples/tree/master/samples/HelloWorld). -### Create a New Project +### Create a New Project 1. Open Eclipse. Go to File > New > Project, create a new Java project `DLRJavaSample`. @@ -48,42 +50,77 @@ Let's start by creating a console application which demonstrates how to use the ### Include the Label Recognizer library -1. Add the Dynamsoft Label Recognizer JAR file to your project. - Click File > Properties > Java Build Path > Libraries > Add external JARs, add `dynamsoft-labelrecognizer-{version number}.jar` and `dynamsoft-core-{version number}.jar` click Apply. - >Note: The JAR file can be found at `[INSTALLATION FOLDER]\lib`. +There are two ways to add the libraries into your project - **Manually** and **Maven**. +#### Option 1: Add the Libraries Manually -2. Import the package in the file `DLRJavaSample.java` - ```java - import com.dynamsoft.dlr.*; +1. Click File > Properties > Java Build Path > Libraries > Add external JARs + +2. add `dynamsoft-labelrecognizer-{version number}.jar` and `dynamsoft-core-{version number}.jar` click Apply. + +>Note: The JAR file can be found at `[INSTALLATION FOLDER]\lib`. + +#### Option 2: Add the Libraries via Maven + +1. Include the following repository configuration in your pom.xml file: + + ```xml + + + dlr + https://download2.dynamsoft.com/maven/jar + + + ``` + +2. Add the following dependencies to your pom.xml file: + + ```xml + + + com.dynamsoft + dlr + 2.2.10 + + + com.dynamsoft + dc + 1.0.0 + + ``` ### Initialize the Label Recognizer -1. Initialize the license key +1. Import the package in the file `DLRJavaSample.java` ```java - // 1.Initialize license. + import com.dynamsoft.dlr.*; + ``` + +2. Initialize the license key + + ```java + // 1.Initialize license. LabelRecognizer.initLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInByb2R1Y3RzIjoyfQ=="); - ``` - + ``` + >Note: >- Network connection is required for the license to work. >- "DLS2***" is a default free public trial license used in the sample. >- You can request a 30-day trial license via the [Request a Trial License](https://www.dynamsoft.com/customer/license/trialLicense?product=dlr&utm_source=guide&package=java){:target="_blank"} link. -2. Create an instance of Dynamsoft Label Recognizer +3. Create an instance of Dynamsoft Label Recognizer ```java // 2.Create an instance of Label Recognizer. LabelRecognizer dlr = new LabelRecognizer(); ``` - ### Recognition Process and How to Use the Results 1. Recognizing text in an image - + ```java DLRResult[] results = null; diff --git a/programming/cplusplus/user-guide.md b/programming/cplusplus/user-guide.md index d586146..0163f3b 100644 --- a/programming/cplusplus/user-guide.md +++ b/programming/cplusplus/user-guide.md @@ -16,26 +16,26 @@ In this guide, you will learn step by step on how to build a label recognizer ap Table of Contents - [User Guide - C++](#user-guide---c) - - [Requirements](#requirements) - - [Installation](#installation) - - [Build Your First Application](#build-your-first-application) - - [Create A New Project](#create-a-new-project) - - [For Windows](#for-windows) - - [For Linux](#for-linux) - - [Include the Library](#include-the-library) - - [Initialize a Capture Vision Router Instance](#initialize-a-capture-vision-router-instance) - - [Recognize and Output Recognition Results](#recognize-and-output-recognition-results) - - [Release the Allocated Memory](#release-the-allocated-memory) - - [Build and Run the Project](#build-and-run-the-project) - - [On windows](#on-windows) - - [On Linux](#on-linux) - - [Process Multiple Images](#process-multiple-images) - - [Preparation Steps](#preparation-steps) - - [Add an Image Source as the Input](#add-an-image-source-as-the-input) - - [Add Captured Result Receiver](#add-captured-result-receiver) - - [Start Recognition](#start-recognition) - - [Release Allocated Memory](#release-allocated-memory) - - [Build and Run the Project Again](#build-and-run-the-project-again) + - [Requirements](#requirements) + - [Installation](#installation) + - [Build Your First Application](#build-your-first-application) + - [Create A New Project](#create-a-new-project) + - [For Windows](#for-windows) + - [For Linux](#for-linux) + - [Include the Library](#include-the-library) + - [Initialize a Capture Vision Router Instance](#initialize-a-capture-vision-router-instance) + - [Recognize and Output Recognition Results](#recognize-and-output-recognition-results) + - [Release the Allocated Memory](#release-the-allocated-memory) + - [Build and Run the Project](#build-and-run-the-project) + - [On windows](#on-windows) + - [On Linux](#on-linux) + - [Process Multiple Images](#process-multiple-images) + - [Preparation Steps](#preparation-steps) + - [Add an Image Source as the Input](#add-an-image-source-as-the-input) + - [Add Captured Result Receiver](#add-captured-result-receiver) + - [Start Recognition](#start-recognition) + - [Release Allocated Memory](#release-allocated-memory) + - [Build and Run the Project Again](#build-and-run-the-project-again) ## Requirements @@ -138,10 +138,17 @@ Let's start by creating a console application which demonstrates the minimum cod 1. Initialize the license key ```cpp + int errorcode = 0; char error[512]; - - CLicenseManager::InitLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9", error, 512); - cout << "License initialization: " << error << endl; + errorcode = CLicenseManager::InitLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9", error, 512); + if (errorcode != ErrorCode::EC_OK && errorcode != ErrorCode::EC_LICENSE_CACHE_USED) + { + cout << "License initialization failed: ErrorCode: " << errorcode << ", ErrorString: " << error << endl; + } + else + { + // other codes... + } ``` >Note: