How to Upgrade
From Version 2.x to 3.x
Dynamsoft Label Recognizer SDK has been refactored to integrate with DynamsoftCaptureVision (DCV)
architecture. To upgrade from version 2.x or earlier to 3.x, we recommend you to follow the User Guide and re-write your codes.
Update the Libraries to 3.x Version
The Dynamsoft Label Recognizer SDK has been split into multiple libraries from the previous single library, and the dependency configuration in the app\build.gradle
file needs to be updated accordingly.
-
Local Dependency Put the following
aar
files intolibs
directory and updateapp\build.gradle
file:DynamsoftCaptureVisionRouter.aar
DynamsoftLabelRecognizer.aar
DynamsoftImageProcessing.aar
DynamsoftNeuralNetwork.aar
DynamsoftCore.aar
DynamsoftLicense.aar
DynamsoftCameraEnhancer.aar
(optional)-
DynamsoftUtility.aar
(optional)dependencies { implementation fileTree(include: ['*.aar'], dir: 'libs') }
-
Remote Dependency(Maven) update
app\build.gradle
file:dependencies { implementation 'com.dynamsoft:dynamsoftlabelrecognizerbundle:{version-number}' }
Note: Please view user guide for the correct version number.
Update the License Activation Code
- Java code in 2.x:
LicenseManager.initLicense("Put your license here", this, new LicenseVerificationListener() {
@Override
public void licenseVerificationCallback(boolean isSuccess, CoreException error) {
if (!isSuccess) {
error.printStackTrace();
}
}
});
- Java code in 3.x:
LicenseManager.initLicense("Put your license here", this, new LicenseVerificationListener() {
@Override
public void onLicenseVerified(boolean isSuccess, Exception error) {
if(!isSuccess){
error.printStackTrace();
}
}
});
Update Single Image Recognizing APIs
The APIs for recognizing text from single image has been adjusted as follows:
Old APIs | New APIs |
---|---|
LabelRecognizer.recognizeFile |
CaptureVisionRouter.capture(String filePath, String templateName) |
LabelRecognizer.recognizeFileInMemory |
CaptureVisionRouter.capture(byte[] fileBytes, String templateName) |
LabelRecognizer.recognizeBuffer |
CaptureVisionRouter.capture(ImageData imageData, String templateName) |
LabelRecognizer.recognizeImage |
CaptureVisionRouter.capture(Bitmap bitmap, String templateName) |
class DLRResult |
class CapturedResult/class RecognizedTextLinesResult |
Update Video Streaming Recognizing APIs
The APIs for recognizing video frames has been adjusted as follows:
Old APIs | New APIs |
---|---|
LabelRecognizer.setImageSource |
CaptureVisionRouter.setInput |
LabelRecognizer.startScanning |
CaptureVisionRouter.startCapturing |
LabelRecognizer.stopScanning |
CaptureVisionRouter.stopCapturing |
LabelRecognizer.setLabelResultListener |
CaptureVisionRouter.addResultReceiver |
interface ImageSource |
interface ImageSourceAdapter |
interface LabelResultListener |
interface CapturedResultReceiver |
class DLRLineResult |
class TextLineResultItem |
Migrate Your Templates
The template system is upgraded. The template you used for the previous version can’t be directly recognized by the new version. Please contact us to upgrade your template.
The template-based APIs have been updated as follows:
Old APIs | New APIs |
---|---|
LabelRecognizer.initRuntimeSettingsFromFile |
CaptureVisionRouter.initSettingsFromFile |
LabelRecognizer.initRuntimeSettings |
CaptureVisionRouter.initSettings |
LabelRecognizer.outputRuntimeSettingsToFile |
CaptureVisionRouter.outputSettingsToFile |
LabelRecognizer.outputRuntimeSettings |
CaptureVisionRouter.outputSettings |
LabelRecognizer.resetRuntimeSettings |
CaptureVisionRouter.resetSettings |
Migrate Your DLRRuntimeSettings
The class DLRRuntimeSettings
has been refactored. It retains commonly used properties while removing the previously complex property settings, which are now exclusively supported through templates.
The APIs for accessing and updating DLRRuntimeSettings
has been adjusted as follows:
Old APIs | New APIs |
---|---|
LabelRecognizer.getRuntimeSettings |
CaptureVisionRouter.getSimplifiedSettings |
LabelRecognizer.updateRuntimeSettings |
CaptureVisionRouter.updateSettings |
Migrate to SimplifiedCaptureVisionSettings
The following properties are replaced by similar properties under SimplifiedCaptureVisionSettings
. They can also be set via a template file(String).
PublicRuntimeSettings Property | SimplifiedCaptureVisionSettings Property | Template File Parameter |
---|---|---|
textArea |
roi & roiMeasuredInPercentage |
TargetROIDef.Location.Offset |
timeout |
timeout |
CaptureVisionTemplates.Timeout |
Migrate to SimplifiedLabelRecognizerSettings
The following properties are replaced by similar properties under SimplifiedLabelRecognizerSettings
. The majority of them can also be set via a template file(String).
PublicRuntimeSettings Property | SimplifiedLabelRecognizerSettings Property | Template File Parameter |
---|---|---|
characterModelName |
characterModelName |
LabelRecognizerTaskSetting.CharacterModelName |
maxThreadCount |
maxThreadsInOneTask |
LabelRecognizerTaskSetting.MaxThreadsInOneTask |
FurtherModes Property | SimplifiedLabelRecognizerSettings Property | Template File Parameter |
---|---|---|
grayscaleTransformationModes |
grayscaleTransformationModes |
ImageParameter.GrayscaleTransformationModes |
grayscaleEnhancementModes |
grayscaleEnhancementModes |
ImageParameter.GrayscaleEnhancementModes |
Migrate to Template File
The following properties can only be set via a template file. Please contact us so that we can help you to transform your current settings to a new template file.
PublicRuntimeSettings Property | Template File Parameter |
---|---|
binarizationModes |
ImageParameter.BinarizationModes |
dictionaryPath |
LabelRecognizerTaskSettings.DictionaryPath |
dictionaryCorrectionThreshold |
LabelRecognizerTaskSettings.DictionaryCorrectionThreshold |
PublicRuntimeSettings.furtherModes Property | Template File Parameter |
---|---|
colourConversionModes |
ImageParameter.ColourConversionModes |
regionPredetectionModes |
ImageParameter.RegionPredetectionModes |
textureDetectionModes |
ImageParameter.TextureDetectionModes |