Skip to content

Commit 6732cd2

Browse files
committed
Add README.md
1 parent d249e8a commit 6732cd2

3 files changed

Lines changed: 148 additions & 0 deletions

File tree

examples/barcode-scanner/README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# LiteCam: Java Camera SDK + Barcode Scanner
2+
3+
This project provides two main components: a lightweight **Java Camera SDK** for cross-platform video capture and a complete **Java Barcode Scanner** application demonstrating real-time barcode detection.
4+
5+
## Prerequisites
6+
- **Java JDK 8+** and **Maven 3.6+**
7+
- **Camera device** (for scanner application)
8+
- Platform dependencies: Windows (Visual Studio), Linux (`libx11-dev libv4l-dev`), macOS (Xcode)
9+
10+
11+
## Components
12+
13+
### 1. LiteCam Java Camera SDK
14+
Lightweight cross-platform camera capture library with JNI bridge.
15+
16+
```bash
17+
# 1. Build Camera SDK
18+
.\build-jar.ps1 # Windows
19+
./build-jar.sh # Linux/macOS
20+
21+
# 2. Run Tests
22+
.\run-litecam.ps1 # Windows
23+
./run-litecam.sh # Linux/macOS
24+
```
25+
26+
**Features:**
27+
- Cross-platform video capture (Windows/Linux/macOS)
28+
- Direct RGB frame access via ByteBuffer
29+
- Multiple resolution support
30+
- Minimal overhead JNI implementation
31+
32+
### 2. Java Barcode Scanner Application
33+
Complete barcode scanning application built with the Camera SDK, Dynamsoft Barcode Reader and ZXing.
34+
35+
```bash
36+
# 1. Build Barcode Scanner
37+
.\build.ps1 # Windows
38+
./build.sh # Linux/macOS
39+
40+
# 2. Run the app
41+
.\run.ps1 # Windows
42+
./run.sh # Linux/macOS
43+
```
44+
45+
**Features:**
46+
- Real-time camera scanning with visual overlays
47+
- Dual engines: ZXing (open-source) + Dynamsoft Barcode Reader (enterprise)
48+
- File processing mode with drag-and-drop
49+
- 25+ barcode formats (1D/2D/Postal)
50+
51+
52+
## Quick Start
53+
54+
```java
55+
// List cameras
56+
String[] devices = LiteCam.listDevices();
57+
58+
// Open camera
59+
LiteCam cam = new LiteCam();
60+
cam.openDevice(0);
61+
cam.setResolution(640, 480);
62+
63+
// Capture frames
64+
ByteBuffer buffer = ByteBuffer.allocateDirect(640 * 480 * 3);
65+
if (cam.grabFrame(buffer)) {
66+
// Process RGB data
67+
byte[] frameData = new byte[buffer.remaining()];
68+
buffer.get(frameData);
69+
}
70+
71+
cam.close();
72+
```
73+
74+
75+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
# Run LiteCam Barcode Scanner
3+
# Shell script to run the Maven-built application
4+
5+
set -e
6+
7+
JAR_PATH="target/litecam-barcode-scanner-1.0.0.jar"
8+
9+
echo "Starting LiteCam Barcode Scanner..."
10+
11+
# Check if JAR exists
12+
if [ ! -f "$JAR_PATH" ]; then
13+
echo "Error: JAR file not found at $JAR_PATH" >&2
14+
echo "Please build the project first:" >&2
15+
echo " ./build.sh" >&2
16+
echo " OR" >&2
17+
echo " mvn package" >&2
18+
exit 1
19+
fi
20+
21+
# Check Java
22+
if ! command -v java &> /dev/null; then
23+
echo "Error: Java is not installed or not found in PATH" >&2
24+
echo "Please install Java and make sure it's accessible from PATH." >&2
25+
exit 1
26+
fi
27+
28+
# Get JAR size for info
29+
if command -v stat &> /dev/null; then
30+
if [[ "$OSTYPE" == "darwin"* ]]; then
31+
# macOS stat command
32+
jar_size=$(stat -f%z "$JAR_PATH" 2>/dev/null || echo "0")
33+
else
34+
# Linux stat command
35+
jar_size=$(stat -c%s "$JAR_PATH" 2>/dev/null || echo "0")
36+
fi
37+
jar_size_mb=$(echo "scale=2; $jar_size / 1048576" | bc 2>/dev/null || echo "unknown")
38+
echo "JAR file: $JAR_PATH (${jar_size_mb} MB)"
39+
else
40+
echo "JAR file: $JAR_PATH"
41+
fi
42+
43+
echo "Starting application..."
44+
45+
# Run the application
46+
java -jar "$JAR_PATH" "$@"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
# Shell script to run LiteCam Java Viewer
3+
4+
set -e
5+
6+
# Get the directory of this script
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
JAR_PATH="$SCRIPT_DIR/litecam.jar"
9+
10+
# Check if JAR file exists
11+
if [ ! -f "$JAR_PATH" ]; then
12+
echo "Error: litecam.jar not found in $SCRIPT_DIR" >&2
13+
echo "Please run build-jar.sh first to build the JAR file." >&2
14+
exit 1
15+
fi
16+
17+
# Check if Java is available
18+
if ! command -v java &> /dev/null; then
19+
echo "Error: Java is not installed or not found in PATH" >&2
20+
echo "Please install Java and make sure it's accessible from PATH." >&2
21+
exit 1
22+
fi
23+
24+
echo "Starting LiteCam Java Viewer..."
25+
26+
# Run the application
27+
java -cp "$JAR_PATH" com.example.litecam.LiteCamViewer "$@"

0 commit comments

Comments
 (0)