Skip to content

Commit

Permalink
Merge pull request #44 from dynamsoft-docs/preview
Browse files Browse the repository at this point in the history
update to internal commit 296f8dd8
  • Loading branch information
Dynamsoft-Henry authored Apr 17, 2024
2 parents 45970e4 + 1885cc0 commit 203b5b6
Show file tree
Hide file tree
Showing 11 changed files with 981 additions and 30 deletions.
6 changes: 4 additions & 2 deletions _data/product_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ version_info_list:
- value: latest version
- value: 2.x
child:
- 2.0.20_android
- 2.0.20_ios
- 2.2.10_ios
- 2.0.20
- 2.0.10_android
- 2.0.10_ios
- value: 1.x
child:
- 1.0.30_android
Expand Down
55 changes: 55 additions & 0 deletions assets/js/ddnMobileVersionSearch.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,60 @@
[
{
"version": "2.2.11",
"matchList": {
"ios":{
"dcvRepoMobile": [
{
"path": "/programming/objectivec-swift/api-reference/utility",
"version": "1.2.11"
}, {
"path": "/programming/objectivec-swift/api-reference/license",
"version": "3.2.11"
}, {
"path": "/programming/objectivec-swift/api-reference/capture-vision-router",
"version": "2.2.11"
}, {
"path": "/programming/objectivec-swift/api-reference/core",
"version": "3.2.11"
}, {
"path": "/programming/objectivec-swift/api-reference/image-processing",
"version": "2.2.11"
}
],
"dcvRepoCore": [
{
"path": "/introduction/",
"version": "2.2.11"
}, {
"path": "/enums/capture-vision-router",
"version": "2.2.11"
}, {
"path": "/enums/core",
"version": "3.2.11"
},{
"path": "/parameters/reference/capture-vision-template",
"version": "2.2.11"
},{
"path": "/parameters/reference/target-roi-def",
"version": "2.2.11"
},{
"path": "/parameters/reference/document-normalizer-task-settings",
"version": "2.2.11"
},{
"path": "/parameters/reference/image-parameter",
"version": "2.2.11"
},{
"path": "/parameters/reference/image-source-options",
"version": "3.2.11"
},{
"path": "/parameters/reference/global-parameter",
"version": "2.2.11"
}
],
"dce": "4.2.1"
}
}
},{
"version": "2.2.10",
"matchList": {
"android":{
Expand Down
131 changes: 131 additions & 0 deletions programming/android/upgrade-instruction-v2.0.20.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
layout: default-layout
title: Upgrade Instructions - Dynamsoft Document Normalizer Android Edition
keywords: android, document normalizer, upgrade
description: This page introduces how to upgrade Dynamsoft Document Normalizer Android Edition from 1.x to 2.x
needAutoGenerateSidebar: false
permalink: /programming/android/upgrade-instruction.html
---

# How to Upgrade

## From version 1.x to 2.x

`DynamsoftDocumentNormalizer` SDK has been revamped to integrate with `DynamsoftCaptureVision (DCV)` architecture. To upgrade from version 1.x to 2.x, we recommend that you follow the [`User Guide`](user-guide.md) and re-write your code to match what is in the guide.

Here are some of the main actions you may take:

### Update the Dependencies

Since the SDK architecture has changed, you have to change your `build.gradle` to include the following libraries:

```groovy
dependencies {
implementation 'com.dynamsoft:dynamsoftcapturevisionrouter:{version-number}'
implementation 'com.dynamsoft:dynamsoftdocumentnormalizer:{version-number}'
implementation 'com.dynamsoft:dynamsoftcameraenhancer:{version-number}'
implementation 'com.dynamsoft:dynamsoftcore:{version-number}'
implementation 'com.dynamsoft:dynamsoftlicense:{version-number}'
implementation 'com.dynamsoft:dynamsoftimageprocessing:{version-number}'
implementation 'com.dynamsoft:dynamsoftutility:{version-number}'
}
```

>Note: Please view [user guide](user-guide.md#add-the-library-via-maven) for the most up-to-date version number.
### Migrate from Class DocumentNormalizer to Class CaptureVisionRouter

The `CaptureVisionRouter` class serves as the central class of DCV's execution flow. It encompasses the following functionalities:

- Retrieving images from the `ImageSourceAdapter`.
- Updating templates and configuring settings.
- Dynamically loading the `DynamsoftDocumentNormalizer` module for document detection and normalization.
- Dispatching the results to registered receivers of type `CapturedResultReceiver`.

### Convert Parameter Templates

The parameter system has been restructured and the template you used for v1.x cannot be directly recognized by v2.x (and beyond). Please <a href="https://www.dynamsoft.com/company/customer-service/#contact" target="_blank">contact us</a> to upgrade your parameter template.

### Update Your Codes

#### Single Image Processing

You should now utilize the provided `capture` API methods instead of the previous `detectQuad` and `normalize` API methods. These `capture` API methods directly return results for boundary detection or document normalization.

```java
CapturedResult capture(String filePath, String templateName) throws CaptureVisionRouterException
CapturedResult capture(byte[] fileBytes, String templateName) throws CaptureVisionRouterException
CapturedResult capture(Bitmap bitmap, String templateName) throws CaptureVisionRouterException
CapturedResult capture(ImageData imageData, String templateName) throws CaptureVisionRouterException
```

#### Batch Image Processing

The DCV architecture allows you to conveniently and continuously obtain frames from the `CameraEnhancer`, and then detect or normalize them. The key steps are as follows:

- Set a `CameraEnhancer` object as the input of the `CaptureVisionRouter` object via the `setInput` API method.
- Register a `CapturedResultReceiver` object as the output of the `CaptureVisionRouter` object via the `addResultReceiver` API method.
- Open/Close camera via `CameraEnhancer.open` and `CameraEnhancer.close` API methods.
- Start/Stop capturing via `CaptureVisionRouter.startCapturing` and `CaptureVisionRouter.stopCapturing` API methods.

```java
public class MainActivity extends AppCompatActivity {

private CaptureVisionRouter mRouter;
private CameraView mCameraView;
private CameraEnhancer mCamera;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

// Add camera view for previewing video.
mCameraView = findViewById(R.id.camera_view);

// Create an instance of Dynamsoft Camera Enhancer for video streaming.
mCamera = new CameraEnhancer(mCameraView, this);

PermissionUtil.requestCameraPermission(MainActivity.this);

// Create an instance of Capture Vision Router.
mRouter = new CaptureVisionRouter(this);

try {
mRouter.setInput(mCamera);
} catch (CaptureVisionRouterException e) {
e.printStackTrace();
}

mRouter.addResultReceiver(new CapturedResultReceiver() {
@Override
public void onNormalizedImagesReceived(NormalizedImagesResult result) {
//TODO:...
}
});
}

@Override
public void onResume() {
super.onResume();
try {
mCamera.open();
mRouter.startCapturing(EnumPresetTemplate.PT_DETECT_AND_NORMALIZE_DOCUMENT);
} catch (CameraEnhancerException | CaptureVisionRouterException e) {
e.printStackTrace();
}
}

@Override
public void onPause() {
super.onPause();
try {
mCamera.close();
} catch (CameraEnhancerException e) {
e.printStackTrace();
}

mRouter.stopCapturing();
}
}
```
8 changes: 1 addition & 7 deletions programming/android/upgrade-instruction.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ Since the SDK architecture has changed, you have to change your `build.gradle` t

```groovy
dependencies {
implementation 'com.dynamsoft:dynamsoftcapturevisionrouter:{version-number}'
implementation 'com.dynamsoft:dynamsoftdocumentnormalizer:{version-number}'
implementation 'com.dynamsoft:dynamsoftcameraenhancer:{version-number}'
implementation 'com.dynamsoft:dynamsoftcore:{version-number}'
implementation 'com.dynamsoft:dynamsoftlicense:{version-number}'
implementation 'com.dynamsoft:dynamsoftimageprocessing:{version-number}'
implementation 'com.dynamsoft:dynamsoftutility:{version-number}'
implementation 'com.dynamsoft:dynamsoftdocumentnormalizerbundle:{version-number}'
}
```

Expand Down
8 changes: 1 addition & 7 deletions programming/android/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,7 @@ There are two ways to add the SDK into your project - **Manually** and **Maven**
```groovy
dependencies {
implementation 'com.dynamsoft:dynamsoftcapturevisionrouter:2.2.10'
implementation 'com.dynamsoft:dynamsoftdocumentnormalizer:2.2.10'
implementation 'com.dynamsoft:dynamsoftcameraenhancer:4.2.0'
implementation 'com.dynamsoft:dynamsoftcore:3.2.10'
implementation 'com.dynamsoft:dynamsoftlicense:3.2.10'
implementation 'com.dynamsoft:dynamsoftimageprocessing:2.2.10'
implementation 'com.dynamsoft:dynamsoftutility:1.2.10'
implementation 'com.dynamsoft:dynamsoftdocumentnormalizerbundle:2.2.10'
}
```

Expand Down
1 change: 1 addition & 0 deletions programming/ios/release-notes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ permalink: /programming/ios/release-notes/index.html

# Release Notes - iOS Edition

- [2.2.11 (04/17/2024)]({{ site.ios_release_notes }}ios-2.html#2211-04172024)
- [2.2.10.1 (03/11/2024)]({{ site.ios_release_notes }}ios-2.html#22101-03112024)
- [2.2.10 (03/07/2024)]({{ site.ios_release_notes }}ios-2.html#2210-03072024)
- [2.0.20 (12/12/2023)]({{ site.ios_release_notes }}ios-2.html#2020-12122023)
Expand Down
6 changes: 6 additions & 0 deletions programming/ios/release-notes/ios-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ permalink: /programming/ios/release-notes/ios-2.html

# Release Notes for iOS SDK - v2.x

## 2.2.11 (04/17/2024)

- Updated the privacy list of `DynamsoftDocumentNormalizer.xcframework` and other related libraries.

## 2.2.10.1 (03/11/2024)

### Fixed

- Fixed a bug where license error is misreported when method [`getIntermediateResultManager`]({{ site.dcv_ios_api }}capture-vision-router/intermediate-result.html#getintermediateresultmanager) is triggered.

## 2.2.10 (03/07/2024)
Expand Down
Loading

0 comments on commit 203b5b6

Please sign in to comment.