Skip to content

Commit 76d8443

Browse files
committed
Initial commit of AISuite Sample & Demo application source code
This commit has the Sample & Demo Application source code that will be available as part of AI Data Capture SDK GA release v3.0.2
0 parents  commit 76d8443

File tree

422 files changed

+33920
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

422 files changed

+33920
-0
lines changed

.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Gradle files
2+
.gradle/
3+
build/
4+
5+
# Local configuration file (sdk path, etc)
6+
local.properties
7+
8+
# Log/OS Files
9+
*.log
10+
11+
# Android Studio generated files and folders
12+
captures/
13+
.externalNativeBuild/
14+
.cxx/
15+
*.apk
16+
output-metadata.json
17+
18+
# IntelliJ
19+
*.iml
20+
.idea/
21+
misc.xml
22+
deploymentTargetDropDown.xml
23+
render.experimental.xml
24+
25+
# Keystore files
26+
*.jks
27+
*.keystore
28+
29+
# Google Services (e.g. APIs or Firebase)
30+
google-services.json
31+
32+
# Android Profiling
33+
*.hprof
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
plugins {
2+
alias(libs.plugins.android.application)
3+
alias(libs.plugins.kotlin.android)
4+
alias(libs.plugins.kotlin.compose)
5+
}
6+
7+
android {
8+
namespace = "com.zebra.aidatacapturedemo"
9+
compileSdk = 36
10+
11+
androidResources {
12+
noCompress.add("tar")
13+
noCompress.add("tar.crypt")
14+
}
15+
16+
defaultConfig {
17+
applicationId = "com.zebra.aidatacapturedemo"
18+
minSdk = 34
19+
targetSdk = 36
20+
versionCode = 4
21+
val appVersion: String = libs.versions.appVersion.get().toString()
22+
versionName = appVersion
23+
24+
buildConfigField("String", "AI_DataCaptureDemo_Version", "\"$appVersion\"")
25+
26+
val zebraAIVisionSdk: String = libs.versions.zebraAIVisionSdk.get().toString()
27+
buildConfigField("String", "Zebra_AI_VisionSdk_Version", "\"$zebraAIVisionSdk\"")
28+
29+
val barcodeLocalizer: String = libs.versions.barcodeLocalizer.get().toString()
30+
buildConfigField("String", "BarcodeLocalizer_Version", "\"$barcodeLocalizer\"")
31+
32+
val textOcrRecognizer: String = libs.versions.textOcrRecognizer.get().toString()
33+
buildConfigField("String", "TextOcrRecognizer_Version", "\"$textOcrRecognizer\"")
34+
35+
val productAndShelfRecognizer: String = libs.versions.productAndShelfRecognizer.get().toString()
36+
buildConfigField("String", "ProductAndShelfRecognizer_Version", "\"$productAndShelfRecognizer\"")
37+
38+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
39+
}
40+
41+
buildTypes {
42+
release {
43+
isMinifyEnabled = false
44+
proguardFiles(
45+
getDefaultProguardFile("proguard-android-optimize.txt"),
46+
"proguard-rules.pro"
47+
)
48+
}
49+
}
50+
buildFeatures {
51+
viewBinding = true
52+
buildConfig = true
53+
compose = true
54+
}
55+
compileOptions {
56+
sourceCompatibility = JavaVersion.VERSION_1_8
57+
targetCompatibility = JavaVersion.VERSION_1_8
58+
isCoreLibraryDesugaringEnabled = true
59+
}
60+
kotlinOptions {
61+
jvmTarget = "1.8"
62+
}
63+
packaging {
64+
resources {
65+
excludes += "/META-INF/{AL2.0,LGPL2.1}"
66+
}
67+
jniLibs {
68+
useLegacyPackaging = true
69+
}
70+
}
71+
}
72+
73+
dependencies {
74+
75+
implementation(libs.androidx.core.ktx)
76+
implementation(libs.androidx.lifecycle.runtime.ktx)
77+
implementation(libs.androidx.activity.compose)
78+
implementation(platform(libs.androidx.compose.bom))
79+
implementation(libs.constraintlayout)
80+
implementation(libs.androidx.ui)
81+
implementation(libs.androidx.ui.graphics)
82+
implementation(libs.androidx.ui.tooling.preview)
83+
implementation(libs.androidx.material3)
84+
implementation(libs.play.services.tasks)
85+
implementation(libs.androidx.navigation.compose.android)
86+
implementation(libs.androidx.documentfile)
87+
coreLibraryDesugaring(libs.desugar.jdk.libs)
88+
89+
implementation(libs.androidx.navigation.compose)
90+
implementation(libs.coil.compose)
91+
implementation(libs.jsoup)
92+
93+
implementation(libs.camera.core)
94+
implementation(libs.camera.camera2)
95+
implementation(libs.camera.lifecycle)
96+
implementation(libs.camera.view)
97+
implementation(libs.androidx.camera.extensions)
98+
99+
// JSON serialization
100+
implementation(libs.gson)
101+
102+
//Below dependency is to get AI Suite SDK
103+
implementation(libs.zebra.ai.vision.sdk) { artifact { type = "aar" } }
104+
105+
//Below dependency is to get Barcode Localizer model for AI Suite SDK
106+
implementation(libs.barcode.localizer) { artifact { type = "aar" } }
107+
108+
//Below dependency is to get OCR model for AI Suite SDK
109+
implementation(libs.text.ocr.recognizer) { artifact { type = "aar" } }
110+
111+
//Below dependency is to get product Recognition model for AI Suite SDK
112+
implementation(libs.product.and.shelf.recognizer) { artifact { type = "aar" } }
113+
114+
androidTestImplementation(platform(libs.androidx.compose.bom))
115+
debugImplementation(libs.androidx.ui.tooling)
116+
debugImplementation(libs.androidx.ui.test.manifest)
117+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<uses-feature
5+
android:name="android.hardware.camera"
6+
android:required="false" />
7+
8+
<uses-permission android:name="android.permission.INTERNET" />
9+
<uses-permission android:name="android.permission.CAMERA" />
10+
11+
<application
12+
android:allowBackup="true"
13+
android:dataExtractionRules="@xml/data_extraction_rules"
14+
android:fullBackupContent="@xml/backup_rules"
15+
android:icon="@mipmap/ic_launcher"
16+
android:label="@string/app_name"
17+
android:roundIcon="@mipmap/ic_launcher_round"
18+
android:supportsRtl="true"
19+
android:theme="@style/Theme.AIDataCaptureDemo">
20+
<activity
21+
android:name=".MainActivity"
22+
android:exported="true"
23+
android:label="@string/app_name"
24+
android:screenOrientation="portrait"
25+
android:theme="@style/Theme.AIDataCaptureDemo">
26+
<intent-filter>
27+
<action android:name="android.intent.action.MAIN" />
28+
29+
<category android:name="android.intent.category.LAUNCHER" />
30+
</intent-filter>
31+
</activity>
32+
</application>
33+
34+
</manifest>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<div id="summary">
2+
Model input size is the resolution your image is resized to before AI
3+
analysis.
4+
<strong
5+
>Smaller sizes are faster and use less memory, while larger sizes can help
6+
detect smaller or more distant barcodes &mdash;but also uses more
7+
processing power and memory.</strong
8+
>
9+
Choose the input size to balance speed and accuracy for your needs.
10+
<strong>Note:</strong> Model Input Size can be customized in increments of 32
11+
using the SDK. The options below represent some generic sizes.
12+
</div>
13+
<div id="description">
14+
Model input size is the resolution your image is resized to before AI
15+
analysis.
16+
<strong
17+
>Smaller sizes are faster, while larger sizes improve accuracy.</strong
18+
>
19+
Choose the input size to balance speed and accuracy for your needs.
20+
<strong>Note:</strong> Model Input Size can be customized in increments of 32
21+
using the SDK. The options below represent some generic sizes.
22+
</div>
23+
<div id="title">Model Input Size Options</div>
24+
<div id="details">
25+
<p><strong>Small &ndash; 640 x 640</strong></p>
26+
<ul>
27+
<li><strong>Fastest</strong> processing</li>
28+
<li>Best for large, clear, or close-up barcodes</li>
29+
<li>May miss small, damaged, or distant barcodes</li>
30+
</ul>
31+
<p><strong>Medium &ndash; 1280 x 1280</strong></p>
32+
<ul>
33+
<li>Balanced speed and accuracy</li>
34+
<li>Handles most barcode types and sizes in standard conditions</li>
35+
</ul>
36+
<p><strong>Large &ndash; 1600 x 1600</strong></p>
37+
<ul>
38+
<li><strong>Higher accuracy</strong></li>
39+
<li>Best for small, damaged, or distant barcodes, &nbsp;</li>
40+
<li><strong>Slower Processing</strong>, and <strong>highest memory/battery consumption</strong></li>
41+
<li><strong>Not recommended for CPU/GPU (inference type)</strong></li>
42+
</ul>
43+
</div>
44+
<div id="recommendation">
45+
<p>
46+
<strong>Recommendation:<br /></strong>
47+
</p>
48+
<ul>
49+
<li><strong>Start with 640x640</strong> for close/large barcode.</li>
50+
<li>Increase to the next size if you encounter issues reading barcodes.</li>
51+
<li>
52+
Use
53+
<strong
54+
>larger model input sizes only for the most demanding and challenging
55+
use cases</strong
56+
>, and only if your device has sufficient processing power and memory.
57+
</li>
58+
</ul>
59+
</div>
60+
<div id="tip">
61+
<p>
62+
<strong>Tip:</strong> Larger model input sizes improve accuracy but come at a
63+
significant cost to speed, memory, and battery life. If the app becomes slow
64+
or unstable, reduce the input size.
65+
<strong
66+
>Experiment to find the smallest size that works reliably for your use
67+
case.</strong
68+
>
69+
</p>
70+
</div>
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<div id="summary">
2+
Camera resolution is the number of pixels in your photo (e.g., 1MP =
3+
1280x720).
4+
<strong
5+
>Higher resolution captures more detail for small or distant barcodes but
6+
uses more power and memory.</strong
7+
>
8+
Benefits are limited if the model input size is low.
9+
</div>
10+
<div id="description">
11+
The camera resolution is the number of pixels in the image captured by your
12+
device (e.g., 1MP = 1280x720, 8MP = 3840x2160). This affects the detail in
13+
the original photo before it&rsquo;s resized for AI processing.
14+
<strong
15+
>Higher resolution means more detail, helping read small, or distant
16+
barcodes&mdash;but also uses more processing power and memory.</strong
17+
>
18+
If speed, battery life, or memory use are your top priorities, low resolution
19+
can be a good choice for large or close-up barcodes.
20+
<strong>Note:</strong> If the model input size is set low, using a high
21+
camera resolution won&rsquo;t improve results much, since the detailed image
22+
will be downscaled before processing.
23+
</div>
24+
<div id="title">Resolution Options</div>
25+
<div id="details">
26+
<p><strong>1MP (1280 x 720)</strong></p>
27+
<ul style="list-style-type: disc">
28+
<li>Fastest, power-efficient</li>
29+
<li>Best for simple, large, or close-up barcodes</li>
30+
<li>May miss small or damaged barcodes</li>
31+
</ul>
32+
<p><strong>2MP (1920 x 1080)</strong></p>
33+
<ul style="list-style-type: disc">
34+
<li>Good for general use, moderate detail</li>
35+
<li>Handles most standard barcode scanning scenarios</li>
36+
</ul>
37+
<p><strong>4MP (2688 x 1512)</strong></p>
38+
<ul style="list-style-type: disc">
39+
<li>
40+
Captures more detail, good for poor contrast or dense, smaller barcodes
41+
</li>
42+
<li>Higher memory and battery use</li>
43+
</ul>
44+
<p><strong>8MP (3840 x 2160)</strong></p>
45+
<ul style="list-style-type: disc">
46+
<li>Maximum detail and accuracy,</li>
47+
<li>Best for extremely small, dense, or challenging use cases.</li>
48+
<li>Slowest and highest memory/battery consumption</li>
49+
<li>
50+
Limited benefit if model input size is low; Not recommended for CPU/GPU
51+
(inference types)
52+
</li>
53+
</ul>
54+
</div>
55+
<div id="recommendation">
56+
<p><strong>Recommendation:</strong></p>
57+
<ul style="list-style-type: disc">
58+
<li>
59+
<strong>Start with 1 or 2MP.</strong> This offers a good balance between
60+
image detail, speed, and battery use.
61+
</li>
62+
<li>
63+
<strong>Increase</strong> to 4MP or 8MP&nbsp;<strong>only if</strong> you
64+
need to capture very small, faint, or distant barcodes, and your device
65+
can handle the extra processing.
66+
</li>
67+
<li>
68+
<strong>Match your camera resolution to your model input size:</strong> If
69+
your model input size is 640x640, higher resolutions provide little
70+
benefit. For larger model input sizes (like 1280x1280 or 1600x1600), a
71+
higher resolution can help.
72+
</li>
73+
</ul>
74+
</div>
75+
<div id="tip">
76+
<p>
77+
<strong>Tip:</strong>&nbsp;Make sure the barcode(s) you want to scan appears
78+
<strong>at least 8 pixels tall</strong> in your image for reliable
79+
recognition.
80+
<strong
81+
>Experiment to find the smallest resolution that works reliably for your
82+
use case</strong
83+
>
84+
</p>
85+
</div>

0 commit comments

Comments
 (0)