iOS API Reference - Settings
You are viewing a history document page of Dynamsoft Label Recognizer iOS v1.x.
Method | Description |
---|---|
appendCharacterModel |
Appends CharacterModel to the SDK object. |
appendSettingsFromFile |
Appends LabelRecognitionParameter settings in a file to the SDK object. |
appendSettingsFromString |
Appends LabelRecognitionParameter settings in a string to the SDK object. |
clearAppendedSettings |
Clears appended LabelRecognitionParameter settings. |
eraseAllCharacterModels |
Erases all CharacterModels the SDK object currently loaded. |
eraseCharacterModelByName |
Erases a name specified CharacterModel from the SDK object. |
getModeArgument |
Get argument value for the specified mode parameter. |
getRuntimeSettings |
Gets the current settings and saves it into a class object. |
outputSettingsToFile |
Outputs LabelRecognitionParameter settings into a file (JSON file). |
resetRuntimeSettings |
Resets the runtime settings. |
setModeArgument |
Set argument value for the specified mode parameter. |
updateReferenceRegionFromBarcodeResults |
Updates reference region which is defined with source type DLR_LST_BARCODE. |
updateRuntimeSettings |
Updates runtime settings with a given class object. |
appendCharacterModel
Appends CharacterModel to the SDK object.
- (void)appendCharacterModel:(NSString*)name prototxtBuffer:(NSData*)prototxtBuffer txtBuffer:(NSData*)txtBuffer characterModelBuffer:(NSData*)characterModelBuffer
Parameters
name
A unique name for the appended CharacterModel.
prototxtBuffer
The .prototxt file data of the CharacterModel in a byte array.
txtBuffer
The .txt file data of the CharacterModel in a byte array.
characterModelBuffer
The .caffemodel file data of the CharacterModel in a byte array.
Code Snippet
- Objective-C
- Swift
DynamsoftLabelRecognition *recognizer; iDMLTSConnectionParameters* lts = [[iDMLTSConnectionParameters alloc] init]; lts.organizationID = @"200001"; lts.sessionPassword = @"******"; recognizer = [[DynamsoftLabelRecognition alloc] initLicenseFromLTS:lts verificationDelegate:self]; - (void)LTSLicenseVerificationCallback:(bool)isSuccess error:(NSError * )error { //TODO add your code for license verification } //construct prototxtBuffer, txtBuffer and characterModelBuffer [recognizer appendCharacterModel:@"your model name" prototxtBuffer: prototxtBuffer txtBuffer: txtBuffer characterModelBuffer: characterModelBuffer];
let lts = iDMLTSConnectionParameters() lts.organizationID = "200001" lts.sessionPassword = "******" let recognizer = DynamsoftLabelRecognition(licenseFromLTS: lts, verificationDelegate: self) //construct prototxtBuffer, txtBuffer and characterModelBuffer recognizer.appendCharacterModel("your model name", prototxtBuffer: prototxtBuffer, txtBuffer: txtBuffer, characterModelBuffer: characterModelBuffer)
appendSettingsFromFile
Appends LabelRecognitionParameter settings in a file to the SDK object.
- (void)appendSettingsFromFile:(NSString*)filePath error:(NSError**)error
Parameters
filePath
The settings file path.
[in,out] error
Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Code Snippet
- Objective-C
- Swift
DynamsoftLabelRecognition *recognizer; iDMLTSConnectionParameters* lts = [[iDMLTSConnectionParameters alloc] init]; lts.organizationID = @"200001"; lts.sessionPassword = @"******"; recognizer = [[DynamsoftLabelRecognition alloc] initLicenseFromLTS:lts verificationDelegate:self]; - (void)LTSLicenseVerificationCallback:(bool)isSuccess error:(NSError * )error { //TODO add your code for license verification } NSError __autoreleasing * error; [recognizer appendSettingsFromFile:@"your file path" error:&error];
let lts = iDMLTSConnectionParameters() lts.organizationID = "200001" lts.sessionPassword = "******" let recognizer = DynamsoftLabelRecognition(licenseFromLTS: lts, verificationDelegate: self) let error: NSError? = NSError() recognizer.appendSettingsFromFile("your file path", error:&error)
appendSettingsFromString
Append a new template string to the current label recognition instance.
- (void)appendSettingsFromString:(NSString*)content error:(NSError**)error
Parameters
content
A JSON string that represents the content of the settings.
[in,out] error
Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Code Snippet
- Objective-C
- Swift
DynamsoftLabelRecognition *recognizer; iDMLTSConnectionParameters* lts = [[iDMLTSConnectionParameters alloc] init]; lts.organizationID = @"200001"; lts.sessionPassword = @"******"; recognizer = [[DynamsoftLabelRecognition alloc] initLicenseFromLTS:lts verificationDelegate:self]; - (void)LTSLicenseVerificationCallback:(bool)isSuccess error:(NSError * )error { //TODO add your code for license verification } NSError __autoreleasing * error; [recognizer appendSettingsFromString:@"{\"LabelRecognitionParameter\":{\"Name\":\"P1\", \"RegionPredetectionModes\":[{\"Mode\":\"DLR_RPM_GENERAL_HSV_CONTRAST\"}], \"ReferenceRegionNameArray\": [\"R1\"]},\"ReferenceRegion\":{\"Name\":\"R1\",\"Localization\":{\"SourceType\":\"DLR_LST_PREDETECTED_REGION\",\"RegionPredetectionModesIndex\":0},\"TextAreaNameArray\":[\"T1\"]},\"TextArea\":{\"Name\":\"T1\",\"CharacterModelName\":\"Number\"}}" error:&error];
let lts = iDMLTSConnectionParameters() lts.organizationID = "200001" lts.sessionPassword = "******" let recognizer = DynamsoftLabelRecognition(licenseFromLTS: lts, verificationDelegate: self) let error: NSError? = NSError() recognizer.appendSettingsFromString("{\"LabelRecognitionParameter\":{\"Name\":\"P1\", \"RegionPredetectionModes\":[{\"Mode\":\"DLR_RPM_GENERAL_HSV_CONTRAST\"}], \"ReferenceRegionNameArray\": [\"R1\"]},\"ReferenceRegion\":{\"Name\":\"R1\",\"Localization\":{\"SourceType\":\"DLR_LST_PREDETECTED_REGION\",\"RegionPredetectionModesIndex\":0},\"TextAreaNameArray\":[\"T1\"]},\"TextArea\":{\"Name\":\"T1\",\"CharacterModelName\":\"Number\"}}", error:&error)
clearAppendedSettings
Clear all appended parameter settings of the current label recognition instance.
- (void)clearAppendedSettings:(NSError**)error;
Parameters
[in,out] error
Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Code Snippet
- Objective-C
- Swift
DynamsoftLabelRecognition *recognizer; iDMLTSConnectionParameters* lts = [[iDMLTSConnectionParameters alloc] init]; lts.organizationID = @"200001"; lts.sessionPassword = @"******"; recognizer = [[DynamsoftLabelRecognition alloc] initLicenseFromLTS:lts verificationDelegate:self]; - (void)LTSLicenseVerificationCallback:(bool)isSuccess error:(NSError * )error { //TODO add your code for license verification } NSError __autoreleasing * error; [recognizer clearAppendedSettings:&error];
let lts = iDMLTSConnectionParameters() lts.organizationID = "200001" lts.sessionPassword = "******" let recognizer = DynamsoftLabelRecognition(licenseFromLTS: lts, verificationDelegate: self) let error: NSError? = NSError() recognizer.clearAppendedSettings(&error)
eraseAllCharacterModels
Erases all CharacterModels the SDK object currently loaded.
- (void)eraseAllCharacterModels;
Code Snippet
- Objective-C
- Swift
DynamsoftLabelRecognition *recognizer; iDMLTSConnectionParameters* lts = [[iDMLTSConnectionParameters alloc] init]; lts.organizationID = @"200001"; lts.sessionPassword = @"******"; recognizer = [[DynamsoftLabelRecognition alloc] initLicenseFromLTS:lts verificationDelegate:self]; - (void)LTSLicenseVerificationCallback:(bool)isSuccess error:(NSError * )error { //TODO add your code for license verification } [recognizer eraseAllCharacterModels];
let lts = iDMLTSConnectionParameters() lts.organizationID = "200001" lts.sessionPassword = "******" let recognizer = DynamsoftLabelRecognition(licenseFromLTS: lts, verificationDelegate: self) recognizer.eraseAllCharacterModels()
eraseCharacterModelByName
Erases a name specified CharacterModel from the SDK object.
- (void)eraseCharacterModelByName:(NSString*)name
Parameters
name
A unique name representing the CharacterModel to erase.
Code Snippet
- Objective-C
- Swift
DynamsoftLabelRecognition *recognizer; iDMLTSConnectionParameters* lts = [[iDMLTSConnectionParameters alloc] init]; lts.organizationID = @"200001"; lts.sessionPassword = @"******"; recognizer = [[DynamsoftLabelRecognition alloc] initLicenseFromLTS:lts verificationDelegate:self]; - (void)LTSLicenseVerificationCallback:(bool)isSuccess error:(NSError * )error { //TODO add your code for license verification } [recognizer eraseCharacterModelByName:@"your model name"];
let lts = iDMLTSConnectionParameters() lts.organizationID = "200001" lts.sessionPassword = "******" let recognizer = DynamsoftLabelRecognition(licenseFromLTS: lts, verificationDelegate: self) recognizer.eraseCharacterModelByName("your model name")
getModeArgument
Get argument value for the specified mode parameter.
- (NSString* _Nonnull)getModeArgument:(NSString* _Nonnull)modeName index:(NSInteger)index argumentName:(NSString* _Nonnull)argumentName error:(NSError* _Nullable * _Nullable)error;
Parameters
modeName
: The mode parameter name to get argument.
index
: The array index of mode parameter to indicate a specific mode.
argumentName
: The name of the argument to get.
[in,out] error
Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Return Value the optional argument for a specified mode in Modes parameters.
Remark
Check follow link for available modes and arguments:
Code Snippet
- Objective-C
- Swift
DynamsoftLabelRecognition *recognizer; iDMLTSConnectionParameters* lts = [[iDMLTSConnectionParameters alloc] init]; lts.organizationID = @"200001"; lts.sessionPassword = @"******"; recognizer = [[DynamsoftLabelRecognition alloc] initLicenseFromLTS:lts verificationDelegate:self]; - (void)LTSLicenseVerificationCallback:(bool)isSuccess error:(NSError * )error { //TODO add your code for license verification } NSError __autoreleasing * error; NSString *argumentValue = [recognizer getModeArgument:@"RegionPredetectionModes" index:0 argumentName:@"AspectRatioRange" error:&error];
let lts = iDMLTSConnectionParameters() lts.organizationID = "200001" lts.sessionPassword = "******" let recognizer = DynamsoftLabelRecognition(licenseFromLTS: lts, verificationDelegate: self) let error: NSError? = NSError() let argumentValue = recognizer.getModeArgument("RegionPredetectionModes", index:0, argumentName:"AspectRatioRange", error:&error)
getRuntimeSettings
Get current settings and save them into a DLRRuntimeSettings
class object.
- (iDLRRuntimeSettings*)getRuntimeSettings:(NSError**)error;
Parameters
[in,out] error
Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Return Value
The class object of runtime settings.
Code Snippet
- Objective-C
- Swift
DynamsoftLabelRecognition *recognizer; iDMLTSConnectionParameters* lts = [[iDMLTSConnectionParameters alloc] init]; lts.organizationID = @"200001"; lts.sessionPassword = @"******"; recognizer = [[DynamsoftLabelRecognition alloc] initLicenseFromLTS:lts verificationDelegate:self]; - (void)LTSLicenseVerificationCallback:(bool)isSuccess error:(NSError * )error { //TODO add your code for license verification } NSError __autoreleasing * error; iDLRRuntimeSettings* settings = [recognizer getRuntimeSettings:&error];
let lts = iDMLTSConnectionParameters() lts.organizationID = "200001" lts.sessionPassword = "******" let recognizer = DynamsoftLabelRecognition(licenseFromLTS: lts, verificationDelegate: self) let error: NSError? = NSError() let settings = recognizer.getRuntimeSettings(&error)
outputSettingsToFile
Outputs runtime settings and save them into a settings file (JSON file).
- (void)outputSettingsToFile:(NSString*)filePath templateName:(NSString*)templateName error:(NSError**)error
Parameters
filePath
The path of the output file which stores current settings.
templateName
A unique name for declaring current runtime settings.
[in,out] error
Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Code Snippet
- Objective-C
- Swift
DynamsoftLabelRecognition *recognizer; NSString *settingsName; iDMLTSConnectionParameters* lts = [[iDMLTSConnectionParameters alloc] init]; lts.organizationID = @"200001"; lts.sessionPassword = @"******"; recognizer = [[DynamsoftLabelRecognition alloc] initLicenseFromLTS:lts verificationDelegate:self]; - (void)LTSLicenseVerificationCallback:(bool)isSuccess error:(NSError * )error { //TODO add your code for license verification } NSError __autoreleasing * error; [recognizer outputSettingsToFile:@"your saving file path" templateName:@"currentRuntimeSettings" error:&error];
let lts = iDMLTSConnectionParameters() lts.organizationID = "200001" lts.sessionPassword = "******" let recognizer = DynamsoftLabelRecognition(licenseFromLTS: lts, verificationDelegate: self) let error: NSError? = NSError() recognizer.outputSettingsToFile("your saving file path", templateName:"currentRuntimeSettings", error:&error)
resetRuntimeSettings
Reset all runtime settings to default values.
- (void)resetRuntimeSettings:(NSError**)error;
Parameters
[in,out] error
Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Code Snippet
- Objective-C
- Swift
DynamsoftLabelRecognition *recognizer; iDMLTSConnectionParameters* lts = [[iDMLTSConnectionParameters alloc] init]; lts.organizationID = @"200001"; lts.sessionPassword = @"******"; recognizer = [[DynamsoftLabelRecognition alloc] initLicenseFromLTS:lts verificationDelegate:self]; - (void)LTSLicenseVerificationCallback:(bool)isSuccess error:(NSError * )error { //TODO add your code for license verification } NSError __autoreleasing * error; [recognizer resetRuntimeSettings:&error];
let lts = iDMLTSConnectionParameters() lts.organizationID = "200001" lts.sessionPassword = "******" let recognizer = DynamsoftLabelRecognition(licenseFromLTS: lts, verificationDelegate: self) let error: NSError? = NSError() recognizer.resetRuntimeSettings(error:&error)
setModeArgument
Set argument value for the specified mode parameter.
- (void)setModeArgument:(NSString* _Nonnull)modeName index:(NSInteger)index argumentName:(NSString* _Nonnull)argumentName argumentValue:(NSString* _Nonnull)argumentValue error:(NSError* _Nullable * _Nullable)error;
Parameters
modeName
: The mode parameter name to set argument.
index
: The array index of mode parameter to indicate a specific mode.
argumentName
: The name of the argument to set.
argumentValue
: The value of the argument to set.
[in,out] error
Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Remark
Check follow link for available modes and arguments:
Code Snippet
- Objective-C
- Swift
DynamsoftLabelRecognition *recognizer; iDMLTSConnectionParameters* lts = [[iDMLTSConnectionParameters alloc] init]; lts.organizationID = @"200001"; lts.sessionPassword = @"******"; recognizer = [[DynamsoftLabelRecognition alloc] initLicenseFromLTS:lts verificationDelegate:self]; - (void)LTSLicenseVerificationCallback:(bool)isSuccess error:(NSError * )error { //TODO add your code for license verification } iDLRRuntimeSettings *settings; NSError __autoreleasing * _Nullable error; [recognizer setModeArgument:@"RegionPredetectionModes" index:0 argumentName:@"AspectRatioRange" argumentValue:"100" error:&error];
let lts = iDMLTSConnectionParameters() lts.organizationID = "200001" lts.sessionPassword = "******" let recognizer = DynamsoftLabelRecognition(licenseFromLTS: lts, verificationDelegate: self) let error: NSError? = NSError() recognizer.setModeArgument("RegionPredetectionModes", index:0, argumentName:"AspectRatioRange", argumentValue:"100", error:&error)
updateReferenceRegionFromBarcodeResults
Updates reference region which is defined with source type DLR_LST_BARCODE.
- (void)updateReferenceRegionFromBarcodeResults:(NSArray<iTextResult*>*)barcodeResults templateName:(NSString *)templateName error:(NSError**)error
Parameters
barcodeResults
The barcode results used to localize reference region.
templateName
The template name. A template name is the value of key LabelRecognitionParameter.Name defined in JSON formatted settings. If no template name is specified, current runtime settings will be used.
[in,out] error
Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Code Snippet
- Objective-C
- Swift
DynamsoftLabelRecognition *recognizer; iDMLTSConnectionParameters* lts = [[iDMLTSConnectionParameters alloc] init]; lts.organizationID = @"200001"; lts.sessionPassword = @"******"; recognizer = [[DynamsoftLabelRecognition alloc] initLicenseFromLTS:lts verificationDelegate:self]; - (void)LTSLicenseVerificationCallback:(bool)isSuccess error:(NSError * )error { //TODO add your code for license verification } NSArray<iTextResult*> *textResults; //get textResults from Dynamsoft Barcode Reader SDK NSError __autoreleasing *error; [recognizer appendSettingsFromString:@"{\"LabelRecognitionParameter\":{\"Name\":\"P1\", \"RegionPredetectionModes\":[{\"Mode\":\"DLR_RPM_GENERAL_HSV_CONTRAST\"}], \"ReferenceRegionNameArray\": [\"R1\"]},\"ReferenceRegion\":{\"Name\":\"R1\",\"Localization\":{\"SourceType\":\"DLR_LST_BARCODE\"},\"TextAreaNameArray\":[\"T1\"]},\"TextArea\":{\"Name\":\"T1\",\"CharacterModelName\":\"Number\"}}" error:&error]; [recognizer updateReferenceRegionFromBarcodeResults:textResults templateName:@"P1" error:&error];
let lts = iDMLTSConnectionParameters() lts.organizationID = "200001" lts.sessionPassword = "******" let recognizer = DynamsoftLabelRecognition(licenseFromLTS: lts, verificationDelegate: self) var textResults = [iTextResult]() //get textResults from Dynamsoft Barcode Reader SDK let error: NSError? = NSError() recognizer.appendSettingsFromString("{\"LabelRecognitionParameter\":{\"Name\":\"P1\", \"RegionPredetectionModes\":[{\"Mode\":\"DLR_RPM_GENERAL_HSV_CONTRAST\"}], \"ReferenceRegionNameArray\": [\"R1\"]},\"ReferenceRegion\":{\"Name\":\"R1\",\"Localization\":{\"SourceType\":\"DLR_LST_BARCODE\"},\"TextAreaNameArray\":[\"T1\"]},\"TextArea\":{\"Name\":\"T1\",\"CharacterModelName\":\"Number\"}}", error:&error) recognizer.updateReferenceRegionFromBarcodeResults(textResults, templateName:"P1", error:&error)
updateRuntimeSettings
Update runtime settings with a given DLRRuntimeSettings
class object.
- (void)updateRuntimeSettings:(iDLRRuntimeSettings*)settings error:(NSError**)error
Parameters
settings
The class object of template settings.
[in,out] error
Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Code Snippet
- Objective-C
- Swift
DynamsoftLabelRecognition *recognizer; iDMLTSConnectionParameters* lts = [[iDMLTSConnectionParameters alloc] init]; lts.organizationID = @"200001"; lts.sessionPassword = @"******"; recognizer = [[DynamsoftLabelRecognition alloc] initLicenseFromLTS:lts verificationDelegate:self]; - (void)LTSLicenseVerificationCallback:(bool)isSuccess error:(NSError * )error { //TODO add your code for license verification } NSError __autoreleasing * error; iDLRRuntimeSettings *settings; settings.linesCount = 1; [recognizer updateRuntimeSettings:settings error:&error];
let lts = iDMLTSConnectionParameters() lts.organizationID = "200001" lts.sessionPassword = "******" let recognizer = DynamsoftLabelRecognition(licenseFromLTS: lts, verificationDelegate: self) let error: NSError? = NSError() let settings = recognizer.getRuntimeSettings(&error) settings.linesCount = 1; recognizer.updateRuntimeSettings(settings, error:&error);