diff --git a/_config.yml b/_config.yml index eac61cb2..e591b367 100644 --- a/_config.yml +++ b/_config.yml @@ -92,6 +92,8 @@ dcvb_parameters: /capture-vision/docs/core/parameters/ dcvb_parameters_reference: /capture-vision/docs/core/parameters/reference/ dcvb_enumerations: /capture-vision/docs/core/enums/ dcvb_cpp_api: /capture-vision/docs/server/programming/cplusplus/api-reference/ +dcvb_dotnet_api: /capture-vision/docs/server/programming/dotnet/api-reference/ +dcvb_python_api: /capture-vision/docs/server/programming/python/api-reference/ maui: /barcode-reader/docs/mobile/programming/maui/ maui_api: /barcode-reader/docs/mobile/programming/maui/api-reference/ diff --git a/programming/features/barcode-formats-and-count.md b/programming/features/barcode-formats-and-count.md index 02adb42b..b23b1500 100644 --- a/programming/features/barcode-formats-and-count.md +++ b/programming/features/barcode-formats-and-count.md @@ -24,6 +24,8 @@ You can configure the parameter in two different ways, depending on your require >- Android >- Objective-C >- Swift +>- Python +>- C# > > ```javascript @@ -84,9 +86,36 @@ do{ // Add code to do when error occurs. } ``` +> +```python +cvr_instance = CaptureVisionRouter() +# Obtain current runtime settings of `CCaptureVisionRouter` instance. +err_code, err_str, settings = cvr_instance.get_simplified_settings(EnumPresetTemplate.PT_READ_BARCODES.value) +# Specify the barcode formats by enumeration values. +# Use "|" to enable multiple barcode formats at one time. +settings.barcode_settings.barcode_format_ids = EnumBarcodeFormat.BF_QR_CODE.value | EnumBarcodeFormat.BF_ONED.value +# Update the settings. +err_code, err_str = cvr_instance.update_settings(EnumPresetTemplate.PT_READ_BARCODES.value, settings) +``` +> +```csharp +using (CaptureVisionRouter cvr = new CaptureVisionRouter()) +{ + SimplifiedCaptureVisionSettings settings; + string errorMsg; + // Obtain current runtime settings of `CCaptureVisionRouter` instance. + cvr.GetSimplifiedSettings(PresetTemplate.PT_READ_BARCODES, out settings); + // Specify the barcode formats by enumeration values. + // Use "|" to enable multiple barcode formats at one time. + settings.barcodeSettings.barcodeFormatIds = (ulong)(EnumBarcodeFormat.BF_QR_CODE | EnumBarcodeFormat.BF_ONED); + // Update the settings. + cvr.UpdateSettings(PresetTemplate.PT_READ_BARCODES, settings, out errorMsg); +} +``` + * Configure barcode format via `JSON parameter template file` - * update parameter `BarcodeFormatIds` in your JSON template + * Update parameter `BarcodeFormatIds` in your JSON template ```json { "CaptureVisionTemplates": [ @@ -110,52 +139,7 @@ do{ } ``` - * apply settings by calling method `InitSettingsFromFile` - -
- >- JavaScript - >- C++ - >- Android - >- Objective-C - >- Swift - > - > - ```javascript - // `router` is an instance of `CaptureVisionRouter`. - // In the JS edition, the method name we use for initialization is different. - router.initSettings("PATH-TO-YOUR-SETTING") - ``` - > - ```c++ - char szErrorMsg[256] = {0}; - CCaptureVisionRouter* cvr = new CCaptureVisionRouter; - cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); - // more process here - ``` - > - ```java - try { - // `cvr` is an instance of `CaptureVisionRouter`. - cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); - } catch (CaptureVisionRouterException e) { - e.printStackTrace(); - } - ``` - > - ```objc - NSError *error; - // `cvr` is an instance of `DSCaptureVisionRouter`. - [self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error]; - ``` - > - ```swift - do{ - //`cvr` is an instance of `CaptureVisionRouter`. - try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") - }catch{ - // Add code to do when error occurs. - } - ``` + * Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). ## Set Barcode Count @@ -178,6 +162,8 @@ You can configure the parameter in two different ways, depending on your require >- Android >- Objective-C >- Swift + >- Python + >- C# > > ```javascript @@ -236,6 +222,30 @@ do{ // Add code to do when error occurs. } ``` +> +```python +cvr_instance = CaptureVisionRouter() +# Obtain current runtime settings of `CCaptureVisionRouter` instance. +err_code, err_str, settings = cvr_instance.get_simplified_settings(EnumPresetTemplate.PT_READ_BARCODES.value) +# Specify the expected barcode count. +settings.barcode_settings.expected_barcodes_count = 1 +# Update the settings. +err_code, err_str = cvr_instance.update_settings(EnumPresetTemplate.PT_READ_BARCODES.value, settings) +``` +> +```csharp +using (CaptureVisionRouter cvr = new CaptureVisionRouter()) +{ + SimplifiedCaptureVisionSettings settings; + string errorMsg; + // Obtain current runtime settings of `CCaptureVisionRouter` instance. + cvr.GetSimplifiedSettings(PresetTemplate.PT_READ_BARCODES, out settings); + // Specify the expected barcode count. + settings.barcodeSettings.expectedBarcodesCount = 1; + // Update the settings. + cvr.UpdateSettings(PresetTemplate.PT_READ_BARCODES, settings, out errorMsg); +} +``` * Configure barcode format via `JSON parameter template file` * update parameter `ExpectedBarcodesCount` in your JSON template @@ -261,49 +271,4 @@ do{ ] } ``` - * apply settings by calling method `InitSettingsFromFile` - - - >- JavaScript - >- C++ - >- Android - >- Objective-C - >- Swift - > - > - ```javascript - // `router` is an instance of `CaptureVisionRouter`. - // In the JS edition, the method name we use for initialization is different. - router.initSettings("PATH-TO-YOUR-SETTING") - ``` - > - ```c++ - char szErrorMsg[256] = {0}; - CCaptureVisionRouter* cvr = new CCaptureVisionRouter; - cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); - // more process here - ``` - > - ```java - try { - // `cvr` is an instance of `CaptureVisionRouter`. - cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); - } catch (CaptureVisionRouterException e) { - e.printStackTrace(); - } - ``` - > - ```objc - NSError *error; - // `cvr` is an instance of `DSCaptureVisionRouter`. - [self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error]; - ``` - > - ```swift - do{ - //`cvr` is an instance of `CaptureVisionRouter`. - try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") - }catch{ - // Add code to do when error occurs. - } - ``` + * Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). diff --git a/programming/features/barcode-scan-region.md b/programming/features/barcode-scan-region.md index 556ef1a7..d49b7a84 100644 --- a/programming/features/barcode-scan-region.md +++ b/programming/features/barcode-scan-region.md @@ -19,6 +19,8 @@ Dynamsoft Barcode Reader (DBR) will locate the code region and decode the entire >- JavaScript >- C++ + >- Python + >- C# > > ```javascript @@ -48,6 +50,43 @@ settings.roiMeasuredInPercentage = 1; // Update the settings. cvr->UpdateSettings(CPresetTemplate::PT_READ_BARCODES, &settings, szErrorMsg, 256); ``` +> +```python +cvr_instance = CaptureVisionRouter() +# Obtain current runtime settings of `CCaptureVisionRouter` instance. +err_code, err_str, settings = cvr_instance.get_simplified_settings(EnumPresetTemplate.PT_READ_BARCODES.value) +# Specify the ROI. +settings.roi_measured_in_percentage = 1 +points = settings.roi.points +points[0].x = 10 +points[0].y = 10 +points[1].x = 90 +points[1].y = 10 +points[2].x = 90 +points[2].y = 90 +points[3].x = 10 +points[3].y = 90 +# Update the settings. +err_code, err_str = cvr_instance.update_settings(EnumPresetTemplate.PT_READ_BARCODES.value, settings) +``` +> +```csharp +using (CaptureVisionRouter cvr = new CaptureVisionRouter()) +{ + SimplifiedCaptureVisionSettings settings; + string errorMsg; + // Obtain current runtime settings of `CCaptureVisionRouter` instance. + cvr.GetSimplifiedSettings(PresetTemplate.PT_READ_BARCODES, out settings); + // Specify the ROI. + settings.roiMeasuredInPercentage = 1; + settings.roi.points[0].Set(10, 10); + settings.roi.points[1].Set(90, 10); + settings.roi.points[2].Set(90, 90); + settings.roi.points[3].Set(10, 90); + // Update the settings. + cvr.UpdateSettings(PresetTemplate.PT_READ_BARCODES, settings, out errorMsg); +} +``` * Configure region via `JSON Template` diff --git a/programming/features/control-terminate-phase.md b/programming/features/control-terminate-phase.md index a9e1782d..1f89c74a 100644 --- a/programming/features/control-terminate-phase.md +++ b/programming/features/control-terminate-phase.md @@ -48,7 +48,7 @@ Below is an example illustrating how to configure parameter `TerminateSetting` v } ``` -To apply the above settings, please follow the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). +Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). ## Timeout @@ -67,6 +67,8 @@ You can configure the parameter in two different ways, depending on your require >- JavaScript >- C++ + >- Python + >- C# > > ```javascript @@ -84,11 +86,35 @@ char szErrorMsg[256] = {0}; CCaptureVisionRouter* cvr = new CCaptureVisionRouter; SimplifiedCaptureVisionSettings settings; cvr->GetSimplifiedSettings(CPresetTemplate::PT_READ_BARCODES, &settings); -// Specify the expected barcode count. +// Specify the timeout. settings.timeout = 1000; // Update the settings. cvr->UpdateSettings(CPresetTemplate::PT_READ_BARCODES, &settings, szErrorMsg, 256); ``` +> +```python +cvr_instance = CaptureVisionRouter() +# Obtain current runtime settings of `CCaptureVisionRouter` instance. +err_code, err_str, settings = cvr_instance.get_simplified_settings(EnumPresetTemplate.PT_READ_BARCODES.value) +# Specify the timeout. +settings.timeout = 1000 +# Update the settings. +err_code, err_str = cvr_instance.update_settings(EnumPresetTemplate.PT_READ_BARCODES.value, settings) +``` +> +```csharp +using (CaptureVisionRouter cvr = new CaptureVisionRouter()) +{ + SimplifiedCaptureVisionSettings settings; + string errorMsg; + // Obtain current runtime settings of `CCaptureVisionRouter` instance. + cvr.GetSimplifiedSettings(PresetTemplate.PT_READ_BARCODES, out settings); + // Specify the timeout. + settings.timeout = 1000; + // Update the settings. + cvr.UpdateSettings(PresetTemplate.PT_READ_BARCODES, settings, out errorMsg); +} +``` * Configure parameter `Timeout` via `JSON Template` @@ -116,4 +142,5 @@ cvr->UpdateSettings(CPresetTemplate::PT_READ_BARCODES, &settings, szErrorMsg, 25 } ``` -To apply the above settings, please follow the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). +Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). + diff --git a/programming/features/filter-and-sort.md b/programming/features/filter-and-sort.md index 3babb779..1558090b 100644 --- a/programming/features/filter-and-sort.md +++ b/programming/features/filter-and-sort.md @@ -23,11 +23,11 @@ Dynamsoft Barcode Reader SDK is able to read multiple barcodes at once and retur * [TextResultOrderModes]({{ site.dcvb_parameters_reference }}barcode-reader-task-settings/text-result-order-modes.html) -## Sample Code +## Example Below is an example illustrating how to filter out QR Code results with confidence higher than 50 and then order the results by position. -* update parameters in your JSON template +* Update parameters in your JSON template ```json { @@ -64,49 +64,4 @@ Below is an example illustrating how to filter out QR Code results with confiden } ``` -* apply settings by calling method `InitSettingsFromFile` - - - >- JavaScript - >- C++ - >- Android - >- Objective-C - >- Swift - > -> -```javascript -// `router` is an instance of `CaptureVisionRouter`. -// In the JS edition, the method name we use for initialization is different. -router.initSettings("PATH-TO-YOUR-SETTING") -``` -> -```c++ -char szErrorMsg[256] = {0}; -CCaptureVisionRouter* cvr = new CCaptureVisionRouter; -cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); -// more process here -``` -> -```java -try { - // `cvr` is an instance of `CaptureVisionRouter`. - cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); -} catch (CaptureVisionRouterException e) { - e.printStackTrace(); -} -``` -> -```objc -NSError *error; -// `cvr` is an instance of `DSCaptureVisionRouter`. -[self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error]; -``` -> -```swift -do{ - //`cvr` is an instance of `CaptureVisionRouter`. - try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") -}catch{ - // Add code to do when error occurs. -} -``` +* Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). diff --git a/programming/features/get-barcode-location.md b/programming/features/get-barcode-location.md index 02e68f5b..255ea803 100644 --- a/programming/features/get-barcode-location.md +++ b/programming/features/get-barcode-location.md @@ -24,6 +24,8 @@ The following code snippet shows how to get the coordinates of the barcode: >- Android >- Objective-C >- Swift + >- Python + >- C# > > ```javascript @@ -111,3 +113,57 @@ func onDecodedBarcodesReceived(_ result: DecodedBarcodesResult) { } } ``` +> +```python +cvr = CaptureVisionRouter() +result = cvr.capture("IMAGE-FILE-PATH", EnumPresetTemplate.PT_READ_BARCODES.value) +if result.get_error_code() != EnumErrorCode.EC_OK: + print("Error:", result.get_error_code(), result.get_error_string()) +barcode_result = result.get_decoded_barcodes_result() +if barcode_result is None or barcode_result.get_items() == 0: + print("No barcode detected.") +else: + items = barcode_result.get_items() + print("Decoded", len(items), "barcodes.") + for index,item in enumerate(items): + quad = item.get_location() + print("Result", index+1) + print("Point 0: [{0},{1}]".format(quad.points[0].x, quad.points[0].y)) + print("Point 1: [{0},{1}]".format(quad.points[1].x, quad.points[1].y)) + print("Point 2: [{0},{1}]".format(quad.points[2].x, quad.points[2].y)) + print("Point 3: [{0},{1}]".format(quad.points[3].x, quad.points[3].y)) +``` +> +```csharp +using (CaptureVisionRouter cvr = new CaptureVisionRouter()) +{ + string imageFile = "IMAGE-FILE-PATH"; + CapturedResult? result = cvr.Capture(imageFile, PresetTemplate.PT_READ_BARCODES); + if (result == null) + { + Console.WriteLine("No barcode detected."); + } + else + { + if (result.GetErrorCode() != 0) + { + Console.WriteLine("Error: " + result.GetErrorCode() + ", " + result.GetErrorString()); + } + DecodedBarcodesResult? barcodesResult = result.GetDecodedBarcodesResult(); + if (barcodesResult != null) + { + BarcodeResultItem[] items = barcodesResult.GetItems(); + Console.WriteLine("Decoded " + items.Length + " barcodes"); + foreach (BarcodeResultItem barcodeItem in items) + { + Console.WriteLine("Result " + (Array.IndexOf(items, barcodeItem) + 1)); + Quadrilateral quad = barcodeItem.GetLocation(); + Console.WriteLine("Point 0: [{0},{1}]", quad.points[0][0], quad.points[0][1]); + Console.WriteLine("Point 1: [{0},{1}]", quad.points[1][0], quad.points[1][1]); + Console.WriteLine("Point 2: [{0},{1}]", quad.points[2][0], quad.points[2][1]); + Console.WriteLine("Point 3: [{0},{1}]", quad.points[3][0], quad.points[3][1]); + } + } + } +} +``` diff --git a/programming/features/get-confidence-rotation.md b/programming/features/get-confidence-rotation.md index 56dd21fc..eea78b8d 100644 --- a/programming/features/get-confidence-rotation.md +++ b/programming/features/get-confidence-rotation.md @@ -45,6 +45,8 @@ The following code snippet shows how to get the confidence and rotation angle of >- Android >- Objective-C >- Swift + >- Python + >- C# > > ```javascript @@ -116,6 +118,55 @@ func onDecodedBarcodesReceived(_ result: DecodedBarcodesResult) { } } ``` +> +```python +cvr = CaptureVisionRouter() +result = cvr.capture("IMAGE-FILE-PATH", EnumPresetTemplate.PT_READ_BARCODES.value) +if result.get_error_code() != EnumErrorCode.EC_OK: + print("Error:", result.get_error_code(), result.get_error_string()) +barcode_result = result.get_decoded_barcodes_result() +if barcode_result is None or barcode_result.get_items() == 0: + print("No barcode detected.") +else: + items = barcode_result.get_items() + print("Decoded", len(items), "barcodes.") + for index,item in enumerate(items): + quad = item.get_location() + print("Result", index+1) + print("Confidence: {0}".format(item.get_confidence())) + print("Angle: {0}".format(item.get_angle())) +``` +> +```csharp +using (CaptureVisionRouter cvr = new CaptureVisionRouter()) +{ + string imageFile = "IMAGE-FILE-PATH"; + CapturedResult? result = cvr.Capture(imageFile, PresetTemplate.PT_READ_BARCODES); + if (result == null) + { + Console.WriteLine("No barcode detected."); + } + else + { + if (result.GetErrorCode() != 0) + { + Console.WriteLine("Error: " + result.GetErrorCode() + ", " + result.GetErrorString()); + } + DecodedBarcodesResult? barcodesResult = result.GetDecodedBarcodesResult(); + if (barcodesResult != null) + { + BarcodeResultItem[] items = barcodesResult.GetItems(); + Console.WriteLine("Decoded " + items.Length + " barcodes"); + foreach (BarcodeResultItem barcodeItem in items) + { + Console.WriteLine("Result " + (Array.IndexOf(items, barcodeItem) + 1)); + Console.WriteLine("Confidence: {0}", barcodeItem.GetConfidence()); + Console.WriteLine("Angle: {0}", barcodeItem.GetAngle()); + } + } + } +} +``` [1]: assets/get-confidence-rotation/1d-angle.png diff --git a/programming/features/get-detailed-info.md b/programming/features/get-detailed-info.md index d39280fc..8e541e7a 100644 --- a/programming/features/get-detailed-info.md +++ b/programming/features/get-detailed-info.md @@ -10,11 +10,11 @@ needAutoGenerateSidebar: false The Dynamsoft Barcode Reader SDK provides APIs for you to get the detailed barcode information like checksum digit, start/stop characters, error correction level, etc. To learn more about what information you can get, see the following items: -- `OneDCodeDetails`: [C++]({{ site.cpp_api }}oned-code-details.html) -- `QRCodeDetails`: [C++]({{ site.cpp_api }}qr-code-details.html) -- `PDF417Details`: [C++]({{ site.cpp_api }}pdf417-details.html) -- `DataMatrixDetails`: [C++]({{ site.cpp_api }}datamatrix-details.html) -- `AztecDetails`: [C++]({{ site.cpp_api }}aztec-details.html) +- `OneDCodeDetails`: [C++]({{ site.cpp_api }}oned-code-details.html) / [Python]({{ site.python_api }}oned-code-details.html) / [.NET]({{ site.dotnet_api }}oned-code-details.html) +- `QRCodeDetails`: [C++]({{ site.cpp_api }}qr-code-details.html) / [Python]({{ site.python_api }}qr-code-details.html) / [.NET]({{ site.dotnet_api }}qr-code-details.html) +- `PDF417Details`: [C++]({{ site.cpp_api }}pdf417-details.html) / [Python]({{ site.python_api }}pdf417-details.html) / [.NET]({{ site.dotnet_api }}pdf417-details.html) +- `DataMatrixDetails`: [C++]({{ site.cpp_api }}datamatrix-details.html) / [Python]({{ site.python_api }}datamatrix-details.html) / [.NET]({{ site.dotnet_api }}datamatrix-details.html) +- `AztecDetails`: [C++]({{ site.cpp_api }}aztec-details.html) / [Python]({{ site.python_api }}aztec-details.html) / [.NET]({{ site.dotnet_api }}aztec-details.html) Here we take QR Code as example and show how to get the version and model of a QR Code. @@ -43,6 +43,8 @@ Here we take QR Code as example and show how to get the version and model of a Q >- Android >- Objective-C >- Swift + >- Python + >- C# > > ```javascript @@ -120,3 +122,56 @@ func onDecodedBarcodesReceived(_ result: DecodedBarcodesResult) { } } ``` +> +```python +cvr = CaptureVisionRouter() +result = cvr.capture("IMAGE-FILE-PATH", EnumPresetTemplate.PT_READ_BARCODES.value) +if result.get_error_code() != EnumErrorCode.EC_OK: + print("Error:", result.get_error_code(), result.get_error_string()) +barcode_result = result.get_decoded_barcodes_result() +if barcode_result is None or barcode_result.get_items() == 0: + print("No barcode detected.") +else: + items = barcode_result.get_items() + print("Decoded", len(items), "barcodes.") + for index,item in enumerate(items): + if item.get_format() == EnumBarcodeFormat.BF_QR_CODE.value: + qrDetail = item.get_details() + print("Version:", qrDetail.version) + print("Model:", qrDetail.model) +``` +> +```csharp +using (CaptureVisionRouter cvr = new CaptureVisionRouter()) +{ + string imageFile = "IMAGE-FILE-PATH"; + CapturedResult? result = cvr.Capture(imageFile, PresetTemplate.PT_READ_BARCODES); + if (result == null) + { + Console.WriteLine("No barcode detected."); + } + else + { + if (result.GetErrorCode() != 0) + { + Console.WriteLine("Error: " + result.GetErrorCode() + ", " + result.GetErrorString()); + } + DecodedBarcodesResult? barcodesResult = result.GetDecodedBarcodesResult(); + if (barcodesResult != null) + { + BarcodeResultItem[] items = barcodesResult.GetItems(); + Console.WriteLine("Decoded " + items.Length + " barcodes"); + foreach (BarcodeResultItem barcodeItem in items) + { + Console.WriteLine("Result " + (Array.IndexOf(items, barcodeItem) + 1)); + if (barcodeItem.GetFormat() == EnumBarcodeFormat.BF_QR_CODE) + { + QRCodeDetails? qrDetail = (QRCodeDetails?)barcodeItem.GetDetails(); + Console.WriteLine("Version: " + qrDetail.version); + Console.WriteLine("Model: " + qrDetail.model); + } + } + } + } +} +``` diff --git a/programming/features/preprocess-images.md b/programming/features/preprocess-images.md index 8bff9938..e7f8938c 100644 --- a/programming/features/preprocess-images.md +++ b/programming/features/preprocess-images.md @@ -42,11 +42,11 @@ Sharpening and smoothing are used to reduce blur. The following sample image dem If the image to be processed is more complicated, you can use the above grayscale enhancement modes in combination. After configuring multiple modes through [`GrayscaleEnhancementModes`]({{ site.dcvb_parameters_reference }}image-parameter/grayscale-enhancement-modes.html), DBR will try each mode in sequence until the number of successful decoded barcodes meets the expected value (`ExpectedBarcodeCount`), or the algorithm combination is exhausted. -## Sample Code +## Example Below is an example illustrating how to configure the parameter `GrayscaleEnhancementModes`. -* update parameter `GrayscaleEnhancementModes` in your JSON template +* Update parameter `GrayscaleEnhancementModes` in your JSON template ```json { @@ -107,52 +107,7 @@ Below is an example illustrating how to configure the parameter `GrayscaleEnhanc } ``` -* apply settings by calling method `InitSettingsFromFile` - - - >- JavaScript - >- C++ - >- Android - >- Objective-C - >- Swift - > -> -```javascript -// `router` is an instance of `CaptureVisionRouter`. -// In the JS edition, the method name we use for initialization is different. -router.initSettings("PATH-TO-YOUR-SETTING") -``` -> -```c++ -char szErrorMsg[256] = {0}; -CCaptureVisionRouter* cvr = new CCaptureVisionRouter; -cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); -// more process here -``` -> -```java -try { - // `cvr` is an instance of `CaptureVisionRouter`. - cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); -} catch (CaptureVisionRouterException e) { - e.printStackTrace(); -} -``` -> -```objc -NSError *error; -// `cvr` is an instance of `DSCaptureVisionRouter`. -[self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error]; -``` -> -```swift -do{ - //`cvr` is an instance of `CaptureVisionRouter`. - try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") -}catch{ - // Add code to do when error occurs. -} -``` +* Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). [1]:assets/preprocess-images/gray-equalize-sample-1.png diff --git a/programming/features/read-a-large-image.md b/programming/features/read-a-large-image.md index 2af8db7d..ae9614cb 100644 --- a/programming/features/read-a-large-image.md +++ b/programming/features/read-a-large-image.md @@ -14,11 +14,11 @@ In some cases, the captured image is very large, so Dynamsoft Barcode Reader (DB > >Don't worry about the location of the barcodes, as DBR will still return their coordinates in the original image. -## Sample Code +## Example Below is an example illustrating how to configure the parameter `ScaleDownThreshold`. -* update parameter `ScaleDownThreshold` in your JSON template +* Update parameter `ScaleDownThreshold` in your JSON template ```json { @@ -62,49 +62,4 @@ Below is an example illustrating how to configure the parameter `ScaleDownThresh } ``` -* apply settings by calling method `InitSettingsFromFile` - - - >- JavaScript - >- C++ - >- Android - >- Objective-C - >- Swift - > -> -```javascript -// `router` is an instance of `CaptureVisionRouter`. -// In the JS edition, the method name we use for initialization is different. -router.initSettings("PATH-TO-YOUR-SETTING") -``` -> -```c++ -char szErrorMsg[256] = {0}; -CCaptureVisionRouter* cvr = new CCaptureVisionRouter; -cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); -// more process here -``` -> -```java -try { - // `cvr` is an instance of `CaptureVisionRouter`. - cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); -} catch (CaptureVisionRouterException e) { - e.printStackTrace(); -} -``` -> -```objc -NSError *error; -// `cvr` is an instance of `DSCaptureVisionRouter`. -[self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error]; -``` -> -```swift -do{ - //`cvr` is an instance of `CaptureVisionRouter`. - try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") -}catch{ - // Add code to do when error occurs. -} -``` +* Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). diff --git a/programming/features/read-barcodes-with-imbalanced-colour.md b/programming/features/read-barcodes-with-imbalanced-colour.md index cabc21a7..1e5e44c1 100644 --- a/programming/features/read-barcodes-with-imbalanced-colour.md +++ b/programming/features/read-barcodes-with-imbalanced-colour.md @@ -41,11 +41,11 @@ As we can see, the gray image converted using only red channel is much better th DBR provides a parameter [`ColourConversionModes`]({{ site.dcvb_parameters_reference }}image-parameter/colour-conversion-modes.html) that allows you to control the conversion of a color image to grayscale. -## Sample Code +## Example Below is an example illustrating how to configure the parameter `ColourConversionModes` to use only red channel. -* update parameter `ColourConversionModes` in your JSON template +* Update parameter `ColourConversionModes` in your JSON template ```json { @@ -96,49 +96,4 @@ Below is an example illustrating how to configure the parameter `ColourConversio } ``` -* apply settings by calling method `InitSettingsFromFile` - - - >- JavaScript - >- C++ - >- Android - >- Objective-C - >- Swift - > -> -```javascript -// `router` is an instance of `CaptureVisionRouter`. -// In the JS edition, the method name we use for initialization is different. -router.initSettings("PATH-TO-YOUR-SETTING") -``` -> -```c++ -char szErrorMsg[256] = {0}; -CCaptureVisionRouter* cvr = new CCaptureVisionRouter; -cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); -// more process here -``` -> -```java -try { - // `cvr` is an instance of `CaptureVisionRouter`. - cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); -} catch (CaptureVisionRouterException e) { - e.printStackTrace(); -} -``` -> -```objc -NSError *error; -// `cvr` is an instance of `DSCaptureVisionRouter`. -[self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error]; -``` -> -```swift -do{ - //`cvr` is an instance of `CaptureVisionRouter`. - try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") -}catch{ - // Add code to do when error occurs. -} -``` +* Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). diff --git a/programming/features/read-barcodes-with-small-module-size.md b/programming/features/read-barcodes-with-small-module-size.md index a349c7c4..1222c654 100644 --- a/programming/features/read-barcodes-with-small-module-size.md +++ b/programming/features/read-barcodes-with-small-module-size.md @@ -22,11 +22,11 @@ In some scenarios, the barcode is very small relative to the entire image, and i Dynamsoft Barcode Reader (DBR) provides a parameter [`ScaleUpModes`]({{ site.dcvb_parameters_reference }}image-parameter/scale-up-modes.html) that allows you to control the scale-up process when targets in the image are too small. -## Sample Code +## Example Below is an example illustrating how to configure the parameter `ScaleUpModes`. -* update parameter `ScaleUpModes` in your JSON template +* Update parameter `ScaleUpModes` in your JSON template ```json { @@ -77,50 +77,4 @@ Below is an example illustrating how to configure the parameter `ScaleUpModes`. } ``` -* apply settings by calling method `InitSettingsFromFile` - - - >- JavaScript - >- C++ - >- Android - >- Objective-C - >- Swift - > -> -```javascript -// `router` is an instance of `CaptureVisionRouter`. -// In the JS edition, the method name we use for initialization is different. -router.initSettings("PATH-TO-YOUR-SETTING") -``` -> -```c++ -char szErrorMsg[256] = {0}; -CCaptureVisionRouter* cvr = new CCaptureVisionRouter; -cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); -// more process here -``` -> -```java -try { - // `cvr` is an instance of `CaptureVisionRouter`. - cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); -} catch (CaptureVisionRouterException e) { - e.printStackTrace(); -} -``` -> -```objc -NSError *error; -// `cvr` is an instance of `DSCaptureVisionRouter`. -[self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error]; -``` -> -```swift -do{ - //`cvr` is an instance of `CaptureVisionRouter`. - try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") -}catch{ - // Add code to do when error occurs. -} -``` - +* Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). diff --git a/programming/features/read-barcodes-with-uneven-lighting.md b/programming/features/read-barcodes-with-uneven-lighting.md index 7c12031f..19bd1e64 100644 --- a/programming/features/read-barcodes-with-uneven-lighting.md +++ b/programming/features/read-barcodes-with-uneven-lighting.md @@ -37,11 +37,11 @@ Obviously, the local thresholding result is much better. Now we will demonstrate DBR provides a parameter [`BinarizationModes`]({{ site.dcvb_parameters_reference }}image-parameter/binarization-modes.html) that allows you to control the conversion of a grayscale image to a binary image. -## Sample Code +## Example Below is an example illustrating how to configure the parameter `BinarizationModes`. -* update parameter `BinarizationModes` in your JSON template +* Update parameter `BinarizationModes` in your JSON template ```json { @@ -93,49 +93,4 @@ Below is an example illustrating how to configure the parameter `BinarizationMod } ``` -* apply settings by calling method `InitSettingsFromFile` - - - >- JavaScript - >- C++ - >- Android - >- Objective-C - >- Swift - > -> -```javascript -// `router` is an instance of `CaptureVisionRouter`. -// In the JS edition, the method name we use for initialization is different. -router.initSettings("PATH-TO-YOUR-SETTING") -``` -> -```c++ -char szErrorMsg[256] = {0}; -CCaptureVisionRouter* cvr = new CCaptureVisionRouter; -cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); -// more process here -``` -> -```java -try { - // `cvr` is an instance of `CaptureVisionRouter`. - cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); -} catch (CaptureVisionRouterException e) { - e.printStackTrace(); -} -``` -> -```objc -NSError *error; -// `cvr` is an instance of `DSCaptureVisionRouter`. -[self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error]; -``` -> -```swift -do{ - //`cvr` is an instance of `CaptureVisionRouter`. - try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") -}catch{ - // Add code to do when error occurs. -} -``` +* Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). diff --git a/programming/features/read-deformed-barcodes.md b/programming/features/read-deformed-barcodes.md index 6f57ad3c..b56a47ff 100644 --- a/programming/features/read-deformed-barcodes.md +++ b/programming/features/read-deformed-barcodes.md @@ -27,11 +27,11 @@ By default, Dynamsoft Barcode Reader (DBR) may not handle such cases well. To ge You can either specify one of the `DeformationResistingModes` or add all of them. If mulpitle modes are specified, the library will switch between the modes automatically until the number of detected barcodes meets the `ExpectedBarcodeCount`. -## Sample Code +## Example Below is an example illustrating how to configure the parameter `DeformationResistingModes`. -* update parameter `DeformationResistingModes` in your JSON template +* Update parameter `DeformationResistingModes` in your JSON template ```json { @@ -63,50 +63,4 @@ Below is an example illustrating how to configure the parameter `DeformationResi } ``` -* apply settings by calling method `InitSettingsFromFile` - - - >- JavaScript - >- C++ - >- Android - >- Objective-C - >- Swift - > -> -```javascript -// `router` is an instance of `CaptureVisionRouter`. -// In the JS edition, the method name we use for initialization is different. -router.initSettings("PATH-TO-YOUR-SETTING") -``` -> -```c++ -char szErrorMsg[256] = {0}; -CCaptureVisionRouter* cvr = new CCaptureVisionRouter; -cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); -// more process here -``` -> -```java -try { - // `cvr` is an instance of `CaptureVisionRouter`. - cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); -} catch (CaptureVisionRouterException e) { - e.printStackTrace(); -} -``` -> -```objc -NSError *error; -// `cvr` is an instance of `DSCaptureVisionRouter`. -[self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error]; -``` -> -```swift -do{ - //`cvr` is an instance of `CaptureVisionRouter`. - try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") -}catch{ - // Add code to do when error occurs. -} -``` - +* Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). diff --git a/programming/features/read-dense-barcodes.md b/programming/features/read-dense-barcodes.md index d040ef1e..95c57108 100644 --- a/programming/features/read-dense-barcodes.md +++ b/programming/features/read-dense-barcodes.md @@ -23,11 +23,11 @@ We can do the following to optimize the read rate of high-density QR codes: - Sharpen the image - Run gray equalization -## Sample Code +## Example Below is an example illustrating how to configure the parameters to read density QR Codes. -* update parameters in your JSON template +* Update parameters in your JSON template ```json { @@ -95,49 +95,4 @@ Below is an example illustrating how to configure the parameters to read density } ``` -* apply settings by calling method `InitSettingsFromFile` - - - >- JavaScript - >- C++ - >- Android - >- Objective-C - >- Swift - > -> -```javascript -// `router` is an instance of `CaptureVisionRouter`. -// In the JS edition, the method name we use for initialization is different. -router.initSettings("PATH-TO-YOUR-SETTING") -``` -> -```c++ -char szErrorMsg[256] = {0}; -CCaptureVisionRouter* cvr = new CCaptureVisionRouter; -cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); -// more process here -``` -> -```java -try { - // `cvr` is an instance of `CaptureVisionRouter`. - cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); -} catch (CaptureVisionRouterException e) { - e.printStackTrace(); -} -``` -> -```objc -NSError *error; -// `cvr` is an instance of `DSCaptureVisionRouter`. -[self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error]; -``` -> -```swift -do{ - //`cvr` is an instance of `CaptureVisionRouter`. - try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") -}catch{ - // Add code to do when error occurs. -} -``` +* Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). diff --git a/programming/features/read-images-with-lots-of-text.md b/programming/features/read-images-with-lots-of-text.md index 3d532361..90c55b5a 100644 --- a/programming/features/read-images-with-lots-of-text.md +++ b/programming/features/read-images-with-lots-of-text.md @@ -10,11 +10,11 @@ needAutoGenerateSidebar: false When trying to read an image where a barcode is surrounded by a large amount of irrelevant text, the presence of these characters may lead to incorrect positioning and slow down the execution speed. Dynamsoft Barcode Reader (DBR) provides parameter [`TextDetectionMode`]({{ site.dcvb_parameters_reference }}image-parameter/text-detection-mode.html) and [`IfEraseTextZone`]({{ site.dcvb_parameters_reference }}image-parameter/if-erase-text-zone.html) to control how to filter texts on an image. -## Sample Code +## Example Below is an example illustrating how to configure the parameters to control text filtering function. -* update parameters in your JSON template +* Update parameters in your JSON template ```json { @@ -66,49 +66,4 @@ Below is an example illustrating how to configure the parameters to control text } ``` -* apply settings by calling method `InitSettingsFromFile` - - - >- JavaScript - >- C++ - >- Android - >- Objective-C - >- Swift - > -> -```javascript -// `router` is an instance of `CaptureVisionRouter`. -// In the JS edition, the method name we use for initialization is different. -router.initSettings("PATH-TO-YOUR-SETTING") -``` -> -```c++ -char szErrorMsg[256] = {0}; -CCaptureVisionRouter* cvr = new CCaptureVisionRouter; -cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); -// more process here -``` -> -```java -try { - // `cvr` is an instance of `CaptureVisionRouter`. - cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); -} catch (CaptureVisionRouterException e) { - e.printStackTrace(); -} -``` -> -```objc -NSError *error; -// `cvr` is an instance of `DSCaptureVisionRouter`. -[self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error]; -``` -> -```swift -do{ - //`cvr` is an instance of `CaptureVisionRouter`. - try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") -}catch{ - // Add code to do when error occurs. -} -``` +* Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). diff --git a/programming/features/read-images-with-texture.md b/programming/features/read-images-with-texture.md index 6a873bbe..be855722 100644 --- a/programming/features/read-images-with-texture.md +++ b/programming/features/read-images-with-texture.md @@ -29,11 +29,11 @@ This may extend the barcode localization time or even lead to localization error As we can see, the binarized image with texture detection enabled is much better. Now we will demonstrate how to configure the parameter [`TextureDetectionModes`]({{ site.dcvb_parameters_reference }}image-parameter/texture-detection-modes.html) to enable texture detection. -## Sample Code +## Example Below is an example illustrating how to configure the parameter `TextureDetectionModes`. -* update parameter `TextureDetectionModes` in your JSON template +* Update parameter `TextureDetectionModes` in your JSON template ```json { @@ -82,49 +82,4 @@ Below is an example illustrating how to configure the parameter `TextureDetectio } ``` -* apply settings by calling method `InitSettingsFromFile` - - - >- JavaScript - >- C++ - >- Android - >- Objective-C - >- Swift - > -> -```javascript -// `router` is an instance of `CaptureVisionRouter`. -// In the JS edition, the method name we use for initialization is different. -router.initSettings("PATH-TO-YOUR-SETTING") -``` -> -```c++ -char szErrorMsg[256] = {0}; -CCaptureVisionRouter* cvr = new CCaptureVisionRouter; -cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); -// more process here -``` -> -```java -try { - // `cvr` is an instance of `CaptureVisionRouter`. - cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); -} catch (CaptureVisionRouterException e) { - e.printStackTrace(); -} -``` -> -```objc -NSError *error; -// `cvr` is an instance of `DSCaptureVisionRouter`. -[self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error]; -``` -> -```swift -do{ - //`cvr` is an instance of `CaptureVisionRouter`. - try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") -}catch{ - // Add code to do when error occurs. -} -``` +* Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). diff --git a/programming/features/read-incomplete-barcodes.md b/programming/features/read-incomplete-barcodes.md index 256a644c..d9090092 100644 --- a/programming/features/read-incomplete-barcodes.md +++ b/programming/features/read-incomplete-barcodes.md @@ -20,12 +20,13 @@ In this case, you can enable the barcode completion logic in Dynamsoft Barcode R > NOTE: > > The barcode completion logic only supports QR code and Data Matrix at present. -> -## Sample Code +> + +## Example Below is an example illustrating how to configure the parameter `BarcodeComplementModes`. -* update parameter `BarcodeComplementModes` in your JSON template +* Update parameter `BarcodeComplementModes` in your JSON template ```json { @@ -54,50 +55,4 @@ Below is an example illustrating how to configure the parameter `BarcodeCompleme } ``` -* apply settings by calling method `InitSettingsFromFile` - - - >- JavaScript - >- C++ - >- Android - >- Objective-C - >- Swift - > -> -```javascript -// `router` is an instance of `CaptureVisionRouter`. -// In the JS edition, the method name we use for initialization is different. -router.initSettings("PATH-TO-YOUR-SETTING") -``` -> -```c++ -char szErrorMsg[256] = {0}; -CCaptureVisionRouter* cvr = new CCaptureVisionRouter; -cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); -// more process here -``` -> -```java -try { - // `cvr` is an instance of `CaptureVisionRouter`. - cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); -} catch (CaptureVisionRouterException e) { - e.printStackTrace(); -} -``` -> -```objc -NSError *error; -// `cvr` is an instance of `DSCaptureVisionRouter`. -[self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error]; -``` -> -```swift -do{ - //`cvr` is an instance of `CaptureVisionRouter`. - try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") -}catch{ - // Add code to do when error occurs. -} -``` - +* Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). diff --git a/programming/features/read-inverted-barcodes.md b/programming/features/read-inverted-barcodes.md index 227115af..315ebdc0 100644 --- a/programming/features/read-inverted-barcodes.md +++ b/programming/features/read-inverted-barcodes.md @@ -21,11 +21,11 @@ The feature to decode such inverted barcodes is not enabled by default. To contr - With only `GTM_INVERTED` enabled in `GrayscaleTransformationModes`, DBR scans only inverted barcodes. - When `GTM_ORIGINAL` is enabled as the first mode and `GTM_INVERTED` is enabled as the second mode in `GrayscaleTransformationModes`, DBR will try to decode general barcodes first. If the count of decoded barcodes does not reach the expected number, DBR will then try decoding the inverted barcodes. -## Sample Code +## Example Below is an example illustrating how to configure the parameter `GrayscaleTransformationModes`. -* update parameter `GrayscaleTransformationModes` in your JSON template +* Update parameter `GrayscaleTransformationModes` in your JSON template ```json { @@ -76,49 +76,4 @@ Below is an example illustrating how to configure the parameter `GrayscaleTransf } ``` -* apply settings by calling method `InitSettingsFromFile` - - - >- JavaScript - >- C++ - >- Android - >- Objective-C - >- Swift - > -> -```javascript -// `router` is an instance of `CaptureVisionRouter`. -// In the JS edition, the method name we use for initialization is different. -router.initSettings("PATH-TO-YOUR-SETTING") -``` -> -```c++ -char szErrorMsg[256] = {0}; -CCaptureVisionRouter* cvr = new CCaptureVisionRouter; -cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); -// more process here -``` -> -```java -try { - // `cvr` is an instance of `CaptureVisionRouter`. - cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); -} catch (CaptureVisionRouterException e) { - e.printStackTrace(); -} -``` -> -```objc -NSError *error; -// `cvr` is an instance of `DSCaptureVisionRouter`. -[self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error]; -``` -> -```swift -do{ - //`cvr` is an instance of `CaptureVisionRouter`. - try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") -}catch{ - // Add code to do when error occurs. -} -``` +* Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). diff --git a/programming/features/use-runtimesettings-or-templates.md b/programming/features/use-runtimesettings-or-templates.md index 82b2f580..a6be8ff5 100644 --- a/programming/features/use-runtimesettings-or-templates.md +++ b/programming/features/use-runtimesettings-or-templates.md @@ -42,6 +42,8 @@ The following code snippet demonstrates how to specify barcode formats via `Simp >- Android >- Objective-C >- Swift + >- Python + >- C# > > ```javascript @@ -97,11 +99,37 @@ do { print("update runtimeSettings error:\(error.localizedDescription)") } ``` +> +```python +cvr_instance = CaptureVisionRouter() +# Obtain current runtime settings of `CCaptureVisionRouter` instance. +err_code, err_str, settings = cvr_instance.get_simplified_settings(EnumPresetTemplate.PT_READ_BARCODES.value) +# Specify the barcode formats by enumeration values. +# Use "|" to enable multiple barcode formats at one time. +settings.barcode_settings.barcode_format_ids = EnumBarcodeFormat.BF_QR_CODE.value | EnumBarcodeFormat.BF_ONED.value +# Update the settings. +err_code, err_str = cvr_instance.update_settings(EnumPresetTemplate.PT_READ_BARCODES.value, settings) +``` +> +```csharp +using (CaptureVisionRouter cvr = new CaptureVisionRouter()) +{ + SimplifiedCaptureVisionSettings settings; + string errorMsg; + // Obtain current runtime settings of `CCaptureVisionRouter` instance. + cvr.GetSimplifiedSettings(PresetTemplate.PT_READ_BARCODES, out settings); + // Specify the barcode formats by enumeration values. + // Use "|" to enable multiple barcode formats at one time. + settings.barcodeSettings.barcodeFormatIds = (ulong)(EnumBarcodeFormat.BF_QR_CODE | EnumBarcodeFormat.BF_ONED); + // Update the settings. + cvr.UpdateSettings(PresetTemplate.PT_READ_BARCODES, settings, out errorMsg); +} +``` **See Also** -- `SimplifiedCaptureVisionSettings:` [C++]({{ site.dcvb_cpp_api }}capture-vision-router/structs/simplified-capture-vision-settings.html) / [JavaScript](https://www.dynamsoft.com/capture-vision/docs/web/programming/javascript/api-reference/capture-vision-router/interfaces/simplified-capture-vision-settings.html) -- `SimplifiedBarcodeReaderSettings:` [C++]({{ site.cpp_api }}simplified-barcode-reader-settings.html) / [JavaScript](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/api-reference/interfaces/simplified-barcode-reader-settings.html) +- `SimplifiedCaptureVisionSettings:` [C++]({{ site.dcvb_cpp_api }}capture-vision-router/structs/simplified-capture-vision-settings.html) / [JavaScript](https://www.dynamsoft.com/capture-vision/docs/web/programming/javascript/api-reference/capture-vision-router/interfaces/simplified-capture-vision-settings.html) / [Python]({{ site.dcvb_python_api }}capture-vision-router/auxiliary-classes/simplified-capture-vision-settings.html) / [.NET]({{ site.dcvb_dotnet_api }}capture-vision-router/auxiliary-classes/simplified-capture-vision-settings.html) +- `SimplifiedBarcodeReaderSettings:` [C++]({{ site.cpp_api }}simplified-barcode-reader-settings.html) / [JavaScript](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/api-reference/interfaces/simplified-barcode-reader-settings.html) / [Python]({{ site.python_api }}simplified-barcode-reader-settings.html) / [.NET]({{ site.dotnet_api }}simplified-barcode-reader-settings.html) ## JSON Template @@ -153,6 +181,8 @@ The following steps demonstrates how to specify barcode formats via `JSON Templa >- Android >- Objective-C >- Swift + >- Python + >- C# > > ```javascript @@ -192,6 +222,34 @@ The following steps demonstrates how to specify barcode formats via `JSON Templa // Add code to do when error occurs. } ``` + > + ```python + cvr_instance = CaptureVisionRouter() + template_file = 'PATH-TO-YOUR-SETTING-FILE' + errorCode, errorMsg = cvr_instance.init_settings_from_file(template_file) + # template_string = 'TEMPLATE-JSON-STRING' + # errorCode, errorMsg = cvr_instance.init_settings(template_string) + if errorCode != EnumErrorCode.EC_OK: + raise Exception("Init template failed: " + errorMsg) + # more process here + ``` + > + ```csharp + int errorCode = 1; + string errorMsg; + using (CaptureVisionRouter cvr = new CaptureVisionRouter()) + { + string templateFile = "PATH-TO-YOUR-SETTING-FILE"; + errorCode = cvr.InitSettingsFromFile(templateFile, out errorMsg); + //string templateString = ""; + //errorCode = cvr.InitSettings(templateString, out errorMsg); + if (errorCode != (int)EnumErrorCode.EC_OK) + { + Console.WriteLine("Init template failed: " + errorMsg); + } + // more process here + } + ``` ## Mixed Usage diff --git a/programming/usecases/read-dpm-codes.md b/programming/usecases/read-dpm-codes.md index fe0cb144..7add2be6 100644 --- a/programming/usecases/read-dpm-codes.md +++ b/programming/usecases/read-dpm-codes.md @@ -18,11 +18,11 @@ It is the process of creating permanent markings on the surface of a part to hel Dynamsoft Barcode Reader (DBR) provides a parameter, [`DPMCodeReadingModes`]({{ site.dcvb_parameters_reference }}barcode-reader-task-settings/dpm-code-reading-modes.html), to control how to decode DPM codes. To enable the DPM feature, simply set a `DPMCRM_GENERAL` mode to this parameter. -## Sample Code +## Example Below is an example illustrating how to configure the parameter `DPMCodeReadingModes` to read DPM code. -* update parameter `DPMCodeReadingModes` in your JSON template +* Update parameter `DPMCodeReadingModes` in your JSON template ```json { @@ -50,45 +50,7 @@ Below is an example illustrating how to configure the parameter `DPMCodeReadingM ] } ``` -* apply settings by calling method `InitSettingsFromFile` - - - >- C++ - >- Android - >- Objective-C - >- Swift - > -> -```c++ -char szErrorMsg[256] = {0}; -CCaptureVisionRouter* cvr = new CCaptureVisionRouter; -cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); -// more process here -``` -> -```java -try { - // `cvr` is an instance of `CaptureVisionRouter`. - cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); -} catch (CaptureVisionRouterException e) { - e.printStackTrace(); -} -``` -> -```objc -NSError *error; -// `cvr` is an instance of `DSCaptureVisionRouter`. -[self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error]; -``` -> -```swift -do{ - //`cvr` is an instance of `CaptureVisionRouter`. - try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") -}catch{ - // Add code to do when error occurs. -} -``` +* Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template). [1]:assets\read-dpm-codes\DPM-sample1.png [2]:assets\read-dpm-codes\DPM-sample2.png diff --git a/programming/usecases/read-postal-codes.md b/programming/usecases/read-postal-codes.md index b8ed4d4c..b90c2f72 100644 --- a/programming/usecases/read-postal-codes.md +++ b/programming/usecases/read-postal-codes.md @@ -36,6 +36,8 @@ You can configure the parameter `BarcodeFormatIds` in two different ways, depend >- Android >- Objective-C >- Swift + >- Python + >- C# > > ```c++ @@ -85,6 +87,32 @@ do{ // Add code to do when error occurs. } ``` +> +```python +cvr_instance = CaptureVisionRouter() +# Obtain current runtime settings of `CCaptureVisionRouter` instance. +err_code, err_str, settings = cvr_instance.get_simplified_settings(EnumPresetTemplate.PT_READ_BARCODES.value) +# Specify the barcode formats by enumeration values. +# Use "|" to enable multiple barcode formats at one time. +settings.barcode_settings.barcode_format_ids = EnumBarcodeFormat.BF_POSTALCODE.value +# Update the settings. +err_code, err_str = cvr_instance.update_settings(EnumPresetTemplate.PT_READ_BARCODES.value, settings) +``` +> +```csharp +using (CaptureVisionRouter cvr = new CaptureVisionRouter()) +{ + SimplifiedCaptureVisionSettings settings; + string errorMsg; + // Obtain current runtime settings of `CCaptureVisionRouter` instance. + cvr.GetSimplifiedSettings(PresetTemplate.PT_READ_BARCODES, out settings); + // Specify the barcode formats by enumeration values. + // Use "|" to enable multiple barcode formats at one time. + settings.barcodeSettings.barcodeFormatIds = (ulong)(EnumBarcodeFormat.BF_POSTALCODE); + // Update the settings. + cvr.UpdateSettings(PresetTemplate.PT_READ_BARCODES, settings, out errorMsg); +} +``` * Configure barcode format via `JSON parameter template file` * update parameter `BarcodeFormatIds` in JSON template @@ -111,44 +139,4 @@ do{ } ``` - * save the above template to file `setting.json` - - * apply settings by calling method `InitSettingsFromFile` - - - >- C++ - >- Android - >- Objective-C - >- Swift - > -> -```c++ -char szErrorMsg[256] = {0}; -CCaptureVisionRouter* cvr = new CCaptureVisionRouter; -cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); -// more process here -``` -> -```java -try { - // `cvr` is an instance of `CaptureVisionRouter`. - cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); -} catch (CaptureVisionRouterException e) { - e.printStackTrace(); -} -``` -> -```objc -NSError *error; -// `cvr` is an instance of `DSCaptureVisionRouter`. -[self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error]; -``` -> -```swift -do{ - //`cvr` is an instance of `CaptureVisionRouter`. - try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") -}catch{ - // Add code to do when error occurs. -} -``` + * Apply the above settings following the article [Use Templates for Configuring Parameters]({{ site.features }}use-runtimesettings-or-templates.html#json-template).