Skip to content

Commit 509e24b

Browse files
Updated side lists and code snippets
1 parent 2fd182a commit 509e24b

7 files changed

Lines changed: 238 additions & 49 deletions

File tree

_includes/sidelist-programming/programming-android.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<li lang="android"><a class="otherLinkColour">Working with Results</a>
2727
<ul lang="android">
2828
<li lang="android"><a href="{{ site.features }}filter-and-sort.html?lang=android" class="otherLinkColour">Parameter Based Result Filter</a></li>
29+
<li lang="android"><a href="{{ site.android }}user-guide/capabilities/get-original-image.html" class="otherLinkColour">Get Original Image</a></li>
2930
<li lang="android"><a href="{{ site.features }}get-detailed-info.html?lang=android" class="otherLinkColour">Get Detailed Barcode Information</a></li>
3031
<li lang="android"><a href="{{ site.features }}get-confidence-rotation.html?lang=android" class="otherLinkColour">Get Barcode Confidence and Rotation</a></li>
3132
<li lang="android"><a href="{{ site.features }}get-barcode-location.html?lang=android" class="otherLinkColour">Get Barcode Location</a></li>

_includes/sidelist-programming/programming-oc.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<li lang="objectivec-swift"><a class="otherLinkColour">Working with Results</a>
2929
<ul lang="objectivec-swift">
3030
<li lang="objectivec-swift"><a href="{{ site.features }}filter-and-sort.html?lang=objc,swift" class="otherLinkColour">Parameter Based Result Filter</a></li>
31+
<li lang="objectivec-swift"><a href="{{ site.oc }}user-guide/capabilities/get-original-image.html" class="otherLinkColour">Get Original Image</a></li>
3132
<li lang="objectivec-swift"><a href="{{ site.features }}get-detailed-info.html?lang=objc,swift" class="otherLinkColour">Get Detailed Barcode Information</a></li>
3233
<li lang="objectivec-swift"><a href="{{ site.features }}get-confidence-rotation.html?lang=objc,swift" class="otherLinkColour">Get Barcode Confidence and Rotation</a></li>
3334
<li lang="objectivec-swift"><a href="{{ site.features }}get-barcode-location.html?lang=objc,swift" class="otherLinkColour">Get Barcode Location</a></li>
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
layout: default-layout
3+
title: Get Original Image - Dynamsoft Barcode Reader Android
4+
description: Learn how to get the original image that produces the current result in the Dynamsoft Barcode Reader Android SDK.
5+
keywords: original image, Android, java, kotlin
6+
noTitleIndex: true
7+
needGenerateH3Content: true
8+
needAutoGenerateSidebar: true
9+
---
10+
11+
# Get Original Image
12+
13+
> [!Important]
14+
> Features on this page are only available for the **Foundational APIs**.
15+
16+
## Get by HashId (Recommended)
17+
18+
Keep your current result output logic unchanged. Use `originalImageHashId` from `DecodedBarcodesResult` to fetch the original image only when needed.
19+
20+
<div class="sample-code-prefix"></div>
21+
>- Java
22+
>- Kotlin
23+
>
24+
>1.
25+
```java
26+
public void onDecodedBarcodesReceived(@NonNull DecodedBarcodesResult result) {
27+
ImageData originalImage = mRouter.getIntermediateResultManager().getOriginalImage(result.getOriginalImageHashId());
28+
}
29+
```
30+
2.
31+
```kotlin
32+
override fun onDecodedBarcodesReceived(result: DecodedBarcodesResult) {
33+
val originalImage = mRouter.intermediateResultManager.getOriginalImage(result.originalImageHashId)
34+
}
35+
```
36+
37+
- [`getOriginalImageHashId`]({{ site.dbr_android_api }}decoded-barcodes-result.html)
38+
- [`getIntermediateResultManager`]({{ site.dcvb_android_api }}capture-vision-router/intermediate-result.html#getintermediateresultmanager)
39+
- [`getOriginalImage`]({{ site.dcvb_android_api }}capture-vision-router/auxiliary-classes/intermediate-result-manager.html#getoriginalimage)
40+
41+
## Include Original Image in Results
42+
43+
Enable original image output in settings so each capture result can directly contain the original image item. This is convenient for downstream processing, but usually adds more data to each result.
44+
45+
<div class="sample-code-prefix"></div>
46+
>- Java
47+
>- Kotlin
48+
>
49+
>1.
50+
```java
51+
try {
52+
SimplifiedCaptureVisionSettings settings = mRouter.getSimplifiedSettings(EnumPresetTemplate.PT_READ_BARCODES);
53+
// Set the outputOriginalImage to true so that the original image will be included in the CapturedResultReceiver.
54+
settings.outputOriginalImage = true;
55+
mRouter.updateSettings(EnumPresetTemplate.PT_READ_BARCODES, settings);
56+
} catch (CaptureVisionRouterException e) {
57+
throw new RuntimeException(e);
58+
}
59+
mRouter.addResultReceiver(new CapturedResultReceiver() {
60+
@Override
61+
public void onCapturedResultReceived(@NonNull CapturedResult result) {
62+
if (result.getItems().length>1)
63+
{
64+
for(CapturedResultItem item:result.getItems())
65+
{
66+
if (item.getType() == EnumCapturedResultItemType.CRIT_BARCODE)
67+
{
68+
// Use barcode result
69+
}else if (item.getType() == EnumCapturedResultItemType.CRIT_ORIGINAL_IMAGE)
70+
{
71+
// USe original image
72+
}
73+
}
74+
}
75+
}
76+
});
77+
```
78+
2.
79+
```kotlin
80+
try {
81+
val settings = mRouter.getSimplifiedSettings(EnumPresetTemplate.PT_READ_BARCODES)
82+
// Set outputOriginalImage to true so that the original image will be included in CapturedResultReceiver.
83+
settings.outputOriginalImage = true
84+
mRouter.updateSettings(EnumPresetTemplate.PT_READ_BARCODES, settings)
85+
} catch (e: CaptureVisionRouterException) {
86+
throw RuntimeException(e)
87+
}
88+
mRouter.addResultReceiver(object : CapturedResultReceiver {
89+
override fun onCapturedResultReceived(result: CapturedResult) {
90+
if (result.items.size > 1) {
91+
for (item in result.items) {
92+
if (item.type == EnumCapturedResultItemType.CRIT_BARCODE) {
93+
// Use barcode result
94+
} else if (item.type == EnumCapturedResultItemType.CRIT_ORIGINAL_IMAGE) {
95+
// Use original image
96+
}
97+
}
98+
}
99+
}
100+
})
101+
```
102+
103+
- [`outputOriginalImage`]({{ site.dcvb_android_api }}capture-vision-router/auxiliary-classes/simplified-capture-vision-settings.html#outputoriginalimage)
104+
- [`onCapturedResultReceived`]({{ site.dcvb_android_api }}capture-vision-router/auxiliary-classes/captured-result-receiver.html#oncapturedresultreceived)

programming/android/user-guide/concept/understand-barcode-results.md

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,20 @@ Error messages are typically caused by:
3333
3434
### Access Decoded Barcodes
3535

36-
Each decoded barcode is a `BarcodeResultItem` from `result.getBarcodes`. The following is an example:
36+
Each decoded barcode is a `BarcodeResultItem` from `result.getBarcodes`. Common fields of a `BarcodeResultItem` include:
37+
38+
- `text`: The decoded string. This is the most common field used for downstream processing.
39+
- `formatString`: The barcode symbology (for example, `QR_CODE`, `EAN_13`).
40+
- `bytes`: Raw payload bytes. By default, barcode text is interpreted using ISO-8859-1. Use this when the payload contains binary data or requires custom decoding.
41+
- `location`: Corner points of the barcode in the image, useful for drawing overlays.
42+
- `confidence`: A confidence score. Higher values indicate more reliable decoding.
43+
- `details`: Symbology-specific details (varies by barcode type).
44+
45+
For example:
3746

3847
![barcode-result-item](../../../assets/barcode-result-item.png)
3948

40-
| BarcodeResultItem | |
49+
| Example BarcodeResultItem | |
4150
| ----------------- | -- |
4251
| `format` | 67108864 |
4352
| `formatString` | QR_CODE |
@@ -51,31 +60,16 @@ Each decoded barcode is a `BarcodeResultItem` from `result.getBarcodes`. The fol
5160
| `isMirrored` | FALSE |
5261
| `details` | rows = 2<br>columns = 2<br>errorCorrectionLevel = L<br>version = 2<br>model = 2<br>mode = 7<br>page = -1<br>totalPage = -1<br>parityData = 0<br>dataMaskPattern = 2<br>codewords = ...... |
5362

54-
### Common fields to use
55-
56-
- `text`: The decoded string. This is the most common field used for downstream processing.
57-
- `formatString`: The barcode symbology (for example, `QR_CODE`, `EAN_13`).
58-
- `bytes`: Raw payload bytes. By default, barcode text is interpreted using ISO-8859-1. Use this when the payload contains binary data or requires custom decoding.
59-
- `location`: Corner points of the barcode in the image, useful for drawing overlays.
60-
- `confidence`: A confidence score. Higher values indicate more reliable decoding.
61-
- `details`: Symbology-specific details (varies by barcode type).
62-
6363
### Access the Original Image
6464

65-
The original image is not returned by default. In `onDecodedBarcodesReceived`, you receive the original image `HashId`, which you can use to fetch the image when needed.
66-
67-
```java
68-
// Use originalImage within the lifecycle of each `onDecodedBarcodesReceived` callback. Otherwise, it may be released or replaced by a newer image.
69-
ImageData originalImage = mRouter.getIntermediateResultManager().getOriginalImage(result.getOriginalImageHashId());
70-
```
65+
The original image is not returned by default. To get the original image, you have 2 options:
7166

72-
**Related APIs**
67+
- (Highly recommended) Get the original image from `IntermediateResultManager` with the `HashId`.
68+
- Let the library to automatically output original image by setting `OutputOriginalImage` parameter.
7369

74-
- [`getOriginalImageHashId`]({{ site.dbr_android_api }}decoded-barcodes-result.html)
75-
- [`getIntermediateResultManager`]({{ site.dcvb_android_api }}capture-vision-router/intermediate-result.html#getintermediateresultmanager)
76-
- [`getOriginalImage`]({{ site.dcvb_android_api }}capture-vision-router/auxiliary-classes/intermediate-result-manager.html#getoriginalimage)
70+
Read [How to get original image](../capabilities/get-original-image.md) for more details.
7771

78-
## Explore Result Details
72+
### Explore Result Details
7973

8074
This page provides a high-level overview of barcode scan results. For detailed usage and advanced scenarios, see:
8175

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
layout: default-layout
3+
title: Get Original Image - Dynamsoft Barcode Reader iOS
4+
description: Learn how to get the original image that produces the current result in the Dynamsoft Barcode Reader iOS SDK.
5+
keywords: original image, iOS, objective-c, swift
6+
noTitleIndex: true
7+
needGenerateH3Content: true
8+
needAutoGenerateSidebar: true
9+
---
10+
11+
# Get Original Image
12+
13+
> [!Important]
14+
> Features on this page are only available for the **Foundational APIs**.
15+
16+
## Get by HashId (Recommended)
17+
18+
Keep your current result output logic unchanged. Use `originalImageHashId` from `DecodedBarcodesResult` to fetch the original image only when needed.
19+
20+
<div class="sample-code-prefix"></div>
21+
>- Objective-C
22+
>- Swift
23+
>
24+
>1.
25+
```objc
26+
- (void)onDecodedBarcodesReceived:(DSDecodedBarcodesResult *)result {
27+
DSImageData *originalImage = [[self.cvr getIntermediateResultManager] getOriginalImage:result.originalImageHashId];
28+
}
29+
```
30+
2.
31+
```swift
32+
func onDecodedBarcodesReceived(_ result: DecodedBarcodesResult) {
33+
let originalImage = cvr.getIntermediateResultManager().getOriginalImage(result.originalImageHashId)
34+
}
35+
```
36+
37+
- [`getOriginalImageHashId`]({{ site.dbr_ios_api }}decoded-barcodes-result.html)
38+
- [`getIntermediateResultManager`]({{ site.dcvb_ios_api }}capture-vision-router/intermediate-result.html#getintermediateresultmanager)
39+
- [`getOriginalImage`]({{ site.dcvb_ios_api }}capture-vision-router/auxiliary-classes/intermediate-result-manager.html#getoriginalimage)
40+
41+
## Include Original Image in Results
42+
43+
Enable original image output in settings so each capture result can directly contain the original image item. This is convenient for downstream processing, but usually adds more data to each result.
44+
45+
<div class="sample-code-prefix"></div>
46+
>- Objective-C
47+
>- Swift
48+
>
49+
>1.
50+
```objc
51+
NSError *error = nil;
52+
DSSimplifiedCaptureVisionSettings *settings = [self.cvr getSimplifiedSettings:DSPresetTemplateReadBarcodes error:&error];
53+
// Set outputOriginalImage to YES so the original image will be included in DSCapturedResultReceiver.
54+
settings.outputOriginalImage = YES;
55+
[self.cvr updateSettings:DSPresetTemplateReadBarcodes settings:settings error:&error];
56+
[self.cvr addResultReceiver:self];
57+
- (void)onCapturedResultReceived:(DSCapturedResult *)result {
58+
if (result.items.count > 1) {
59+
for (DSCapturedResultItem *item in result.items) {
60+
if (item.type == DSCapturedResultItemTypeBarcode) {
61+
// Use barcode result
62+
} else if (item.type == DSCapturedResultItemTypeOriginalImage) {
63+
// Use original image
64+
}
65+
}
66+
}
67+
}
68+
```
69+
2.
70+
```swift
71+
do {
72+
let settings = try cvr.getSimplifiedSettings(PresetTemplate.readBarcodes.rawValue)
73+
// Set outputOriginalImage to true so the original image will be included in CapturedResultReceiver.
74+
settings.outputOriginalImage = true
75+
try cvr.updateSettings(PresetTemplate.readBarcodes.rawValue, settings: settings)
76+
} catch {
77+
}
78+
cvr.addResultReceiver(self)
79+
func onCapturedResultReceived(_ result: CapturedResult) {
80+
if result.items.count > 1 {
81+
for item in result.items {
82+
if item.type == .barcode {
83+
// Use barcode result
84+
} else if item.type == .originalImage {
85+
// Use original image
86+
}
87+
}
88+
}
89+
}
90+
```
91+
92+
- [`outputOriginalImage`]({{ site.dcvb_ios_api }}capture-vision-router/auxiliary-classes/simplified-capture-vision-settings.html#outputoriginalimage)
93+
- [`onCapturedResultReceived`]({{ site.dcvb_ios_api }}capture-vision-router/auxiliary-classes/captured-result-receiver.html#oncapturedresultreceived)

programming/objectivec-swift/user-guide/capabilities/read-specific-area.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,13 @@ config.scanRegion = region
8888
```objc
8989
NSError *error = nil;
9090
DSSimplifiedCaptureVisionSettings *captureVisionSettings = [self.cvr getSimplifiedSettings:DSPresetTemplateReadBarcodes error:&error];
91-
DSQuadrilateral *roiQuad = [[DSQuadrilateral alloc] init];
92-
roiQuad.points[0] = CGPointMake(15, 30);
93-
roiQuad.points[1] = CGPointMake(85, 30);
94-
roiQuad.points[2] = CGPointMake(85, 70);
95-
roiQuad.points[3] = CGPointMake(15, 70);
91+
NSArray<NSValue *> *points = @[
92+
[NSValue valueWithCGPoint:CGPointMake(15, 30)],
93+
[NSValue valueWithCGPoint:CGPointMake(85, 30)],
94+
[NSValue valueWithCGPoint:CGPointMake(85, 70)],
95+
[NSValue valueWithCGPoint:CGPointMake(15, 70)]
96+
];
97+
DSQuadrilateral *roiQuad = [[DSQuadrilateral alloc] initWithPointArray:points];
9698
captureVisionSettings.roi = roiQuad;
9799
captureVisionSettings.roiMeasuredInPercentage = YES;
98100
[self.cvr updateSettings:DSPresetTemplateReadBarcodes settings:captureVisionSettings error:&error];

programming/objectivec-swift/user-guide/concept/understand-barcode-results.md

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,20 @@ Error messages are typically caused by:
3333
3434
### Access Decoded Barcodes
3535

36-
Each decoded barcode is a `BarcodeResultItem` from `result.getBarcodes`. The following is an example:
36+
Each decoded barcode is a `BarcodeResultItem` from `result.getBarcodes`. Common fields of a `BarcodeResultItem` include:
37+
38+
- `text`: The decoded string. This is the most common field used for downstream processing.
39+
- `formatString`: The barcode symbology (for example, `QR_CODE`, `EAN_13`).
40+
- `bytes`: Raw payload bytes. By default, barcode text is interpreted using ISO-8859-1. Use this when the payload contains binary data or requires custom decoding.
41+
- `location`: Corner points of the barcode in the image, useful for drawing overlays.
42+
- `confidence`: A confidence score. Higher values indicate more reliable decoding.
43+
- `details`: Symbology-specific details (varies by barcode type).
44+
45+
For example:
3746

3847
![barcode-result-item](../../../assets/barcode-result-item.png)
3948

40-
| BarcodeResultItem | |
49+
| Example BarcodeResultItem | |
4150
| ----------------- | -- |
4251
| `format` | 67108864 |
4352
| `formatString` | QR_CODE |
@@ -51,31 +60,16 @@ Each decoded barcode is a `BarcodeResultItem` from `result.getBarcodes`. The fol
5160
| `isMirrored` | FALSE |
5261
| `details` | rows = 2<br>columns = 2<br>errorCorrectionLevel = L<br>version = 2<br>model = 2<br>mode = 7<br>page = -1<br>totalPage = -1<br>parityData = 0<br>dataMaskPattern = 2<br>codewords = ...... |
5362

54-
### Common fields to use
55-
56-
- `text`: The decoded string. This is the most common field used for downstream processing.
57-
- `formatString`: The barcode symbology (for example, `QR_CODE`, `EAN_13`).
58-
- `bytes`: Raw payload bytes. By default, barcode text is interpreted using ISO-8859-1. Use this when the payload contains binary data or requires custom decoding.
59-
- `location`: Corner points of the barcode in the image, useful for drawing overlays.
60-
- `confidence`: A confidence score. Higher values indicate more reliable decoding.
61-
- `details`: Symbology-specific details (varies by barcode type).
62-
6363
### Access the Original Image
6464

65-
The original image is not returned by default. In `onDecodedBarcodesReceived`, you receive the original image `HashId`, which you can use to fetch the image when needed.
66-
67-
```java
68-
// Use originalImage within the lifecycle of each `onDecodedBarcodesReceived` callback. Otherwise, it may be released or replaced by a newer image.
69-
ImageData originalImage = mRouter.getIntermediateResultManager().getOriginalImage(result.getOriginalImageHashId());
70-
```
65+
The original image is not returned by default. To get the original image, you have 2 options:
7166

72-
**Related APIs**
67+
- (Highly recommended) Get the original image from `IntermediateResultManager` with the `HashId`.
68+
- Let the library to automatically output original image by setting `OutputOriginalImage` parameter.
7369

74-
- [`getOriginalImageHashId`]({{ site.dbr_ios_api }}decoded-barcodes-result.html)
75-
- [`getIntermediateResultManager`]({{ site.dcvb_ios_api }}capture-vision-router/intermediate-result.html#getintermediateresultmanager)
76-
- [`getOriginalImage`]({{ site.dcvb_ios_api }}capture-vision-router/auxiliary-classes/intermediate-result-manager.html#getoriginalimage)
70+
Read [How to get original image](../capabilities/get-original-image.md) for more details.
7771

78-
## Explore Result Details
72+
### Explore Result Details
7973

8074
This page provides a high-level overview of barcode scan results. For detailed usage and advanced scenarios, see:
8175

0 commit comments

Comments
 (0)