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.
-
Local Dependency You have to drag and drop the following xcframeworks into your Xcode project to use Dynamsoft Label Recognizer.
DynamsoftCaptureVisionRouter.xcframework
DynamsoftLabelRecognizer.xcframework
DynamsoftImageProcessing.xcframework
DynamsoftCore.xcframework
DynamsoftLicense.xcframework
DynamsoftCameraEnhancer.xcframework
(optional)DynamsoftUtility.xcframework
(optional)
-
Remote Dependency(CocoaPods) update Podfile:
target '{Your project name}' do use_frameworks! pod 'DynamsoftLabelRecognizer','3.0.20' pod 'DynamsoftCaptureVisionRouter','2.0.21' pod 'DynamsoftCore','3.0.20' pod 'DynamsoftImageProcessing','2.0.21' pod 'DynamsoftLicense','3.0.30' pod 'DynamsoftCameraEnhancer','4.0.2' pod 'DynamsoftUtility','1.0.21' end
Note: Please view user guide for the correct version number.
Update the License Activation Code
- License activation code in 2.x:
- Objective-C
- Swift
@interface AppDelegate ()<LicenseVerificationListener> ... - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { ... [DynamsoftLicenseManager initLicense:@"Put Your License Here" verificationDelegate:self]; } - (void)licenseVerificationCallback:(bool)isSuccess error:(NSError *)error { // Add code to execute when license verification is approved or failed. }
class AppDelegate: UIResponder, UIApplicationDelegate, LicenseVerificationListener { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { DynamsoftLicenseManager.initLicense("Put Your License Here",verificationDelegate:self) } func licenseVerificationCallback(_ isSuccess: Bool, error: Error?) { // Add code to execute when license verification is approved or failed. } }
- License activation code in 3.x:
- Objective-C
- Swift
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [DSLicenseManager initLicense:@"DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" verificationDelegate:self]; return YES; } - (void)onLicenseVerified:(BOOL)isSuccess error:(NSError *)error { if (error != nil) { NSString *msg = error.localizedDescription; NSLog(@"erver license verify failed, error:%@", msg); } }
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { LicenseManager.initLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9", verificationDelegate:self) return true } func onLicenseVerified(_ isSuccess: Bool, error: Error?) { if(error != nil) { if let msg = error?.localizedDescription { print("Server license verify failed, error:\(msg)") } } }
Update Single Image Recognizing APIs
The APIs for recognizing text from single image has been adjusted as follows:
Old APIs | New APIs |
---|---|
DynamsoftLabelRecognizer.recognizeFile |
DSCaptureVisionRouter.captureFromFile |
DynamsoftLabelRecognizer.recognizeFileInMemory |
DSCaptureVisionRouter.captureFromFileBytes |
DynamsoftLabelRecognizer.recognizeBuffer |
DSCaptureVisionRouter.captureFromBuffer |
DynamsoftLabelRecognizer.recognizeImage |
DSCaptureVisionRouter.captureFromImage |
class iDLRResult |
class DSCapturedResult/class DSRecognizedTextLinesResult |
Update Video Streaming Recognizing APIs
The APIs for recognizing video frames has been adjusted as follows:
Old APIs | New APIs |
---|---|
DynamsoftLabelRecognizer.setImageSource |
DSCaptureVisionRouter.setInput |
DynamsoftLabelRecognizer.startScanning |
DSCaptureVisionRouter.startCapturing |
DynamsoftLabelRecognizer.stopScanning |
DSCaptureVisionRouter.stopCapturing |
DynamsoftLabelRecognizer.setLabelResultListener |
DSCaptureVisionRouter.addResultReceiver |
protocol ImageSource |
protocol DSImageSourceAdapter |
protocol LabelResultListener |
protocol DSCapturedResultReceiver |
class iDLRLineResult |
class DSTextLineResultItem |
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 |
---|---|
DynamsoftLabelRecognizer.initRuntimeSettingsFromFile |
DSCaptureVisionRouter.initSettingsFromFile |
DynamsoftLabelRecognizer.initRuntimeSettings |
DSCaptureVisionRouter.initSettings |
DynamsoftLabelRecognizer.outputRuntimeSettingsToFile |
DSCaptureVisionRouter.outputSettingsToFile |
DynamsoftLabelRecognizer.outputRuntimeSettings |
DSCaptureVisionRouter.outputSettings |
DynamsoftLabelRecognizer.resetRuntimeSettings |
DSCaptureVisionRouter.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 |
---|---|
DynamsoftLabelRecognizer.getRuntimeSettings |
DSCaptureVisionRouter.getSimplifiedSettings |
DynamsoftLabelRecognizer.updateRuntimeSettings |
DSCaptureVisionRouter.updateSettings |
Migrate to DSSimplifiedCaptureVisionSettings
The following properties are replaced by similar properties under DSSimplifiedCaptureVisionSettings
. They can also be set via a template file(String).
PublicRuntimeSettings Property | DSSimplifiedCaptureVisionSettings Property | Template File Parameter |
---|---|---|
textArea |
roi & roiMeasuredInPercentage |
TargetROIDef.Location.Offset |
timeout |
timeout |
CaptureVisionTemplates.Timeout |
Migrate to DSSimplifiedLabelRecognizerSettings
The following properties are replaced by similar properties under DSSimplifiedLabelRecognizerSettings
. The majority of them can also be set via a template file(String).
PublicRuntimeSettings Property | DSSimplifiedLabelRecognizerSettings Property | Template File Parameter |
---|---|---|
characterModelName |
characterModelName |
DynamsoftLabelRecognizerTaskSetting.CharacterModelName |
maxThreadCount |
maxThreadsInOneTask |
DynamsoftLabelRecognizerTaskSetting.MaxThreadsInOneTask |
FurtherModes Property | DSSimplifiedLabelRecognizerSettings 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 |
DynamsoftLabelRecognizerTaskSettings.DictionaryPath |
dictionaryCorrectionThreshold |
DynamsoftLabelRecognizerTaskSettings.DictionaryCorrectionThreshold |
PublicRuntimeSettings.furtherModes Property | Template File Parameter |
---|---|
colourConversionModes |
ImageParameter.ColourConversionModes |
regionPredetectionModes |
ImageParameter.RegionPredetectionModes |
textureDetectionModes |
ImageParameter.TextureDetectionModes |