File size: 1,666 Bytes
16d34b9
 
 
 
 
 
 
 
 
b42373a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
title: Chassis OCR
emoji: πŸ”§
colorFrom: blue
colorTo: green
sdk: docker
pinned: false
---

# Chassis OCR Pipeline

Reads engraved chassis numbers from phone images and matches them against barcode-scanned numbers.

## Setup

```bash
pip install -r requirements.txt
```

On Linux you also need:
```bash
sudo apt-get install libzbar0
```

## Project Structure

```
chassis_ocr/
β”œβ”€β”€ images/
β”‚   β”œβ”€β”€ barcode/     ← put your 50 barcode images here
β”‚   └── chassis/     ← put your 50 chassis images here (same filenames)
β”œβ”€β”€ results/         ← comparison images + report saved here
β”œβ”€β”€ preprocess.py    ← image cleaning pipeline
β”œβ”€β”€ barcode_scanner.py
β”œβ”€β”€ ocr.py
└── evaluate.py      ← run this
```

## Important β€” Naming Convention

Barcode and chassis images must have the **same filename** to be paired:
```
images/barcode/001.jpg  ←→  images/chassis/001.jpg
images/barcode/002.jpg  ←→  images/chassis/002.jpg
```

## Run

```bash
# Test preprocessing on a single chassis image
python preprocess.py images/chassis/001.jpg

# Test OCR on a single chassis image  
python ocr.py images/chassis/001.jpg

# Run full evaluation on all 50 pairs
python evaluate.py
```

## Output

After running `evaluate.py`:
- `results/report.json` β€” full accuracy breakdown
- `results/*_comparison.jpg` β€” before/after preprocessing for each image

## Pipeline

```
Barcode image β†’ pyzbar β†’ ground truth string
                                              β†˜
Chassis image β†’ CLAHE β†’ Adaptive threshold     Compare β†’ βœ… Match / ❌ Mismatch
             β†’ Morphological ops β†’ PaddleOCR β†—
```