A Flask-based web application that classifies documents (ID cards, letters, receipts, etc.) using OCR and detects QR codes in real-time via camera or uploaded images.
- 📄 Document Classification: Categorizes documents into KTP, Kartu Keluarga, Surat, Nota, or Lainnya
- 🔍 QR Code Detection: Real-time QR code scanning with visual overlay
- 📷 Camera Integration: Live OCR processing with stability detection
- 🖼️ Image Upload: Supports JPG/PNG uploads up to 16MB
- 🚀 Lightweight: Uses TensorFlow Lite for efficient inference
DCSPython
├── app.py # Main Flask application
├── calibrate_stability.py # Camera stability calibration tool
├── generate_qr.py # QR code generator for testing
├── test_qr.py # QR detection tester
├── test_camera.py # Camera tester
├── templates/ # HTML templates
│ ├── index.html # Homepage
│ ├── camera.html # Camera interface
│ └── result.html # Results page
├── static/ # Static files
│ └── style.css # CSS styles
└── uploads/ # Temporary upload storage
-
Clone the repository:
git clone https://github.com/Elang-elang/DCSPython.git cd DCSPython -
Install dependencies:
pip install flask numpy opencv-python pytesseract pyzbar pillow qrcode
-
Install Tesseract OCR (required for text extraction):
- Windows: Download from Tesseract installer
- Mac:
brew install tesseract - Linux:
sudo apt install tesseract-ocr
-
Start the Flask server:
python app.py
-
Open your browser to:
http://localhost:5000
-
Generate test QR codes:
python generate_qr.py
-
Test camera stability:
python calibrate_stability.py
-
Test QR detection:
python test_qr.py
-
For best OCR results:
- Ensure good lighting
- Keep the camera steady
- Position documents flat
-
Camera mode automatically processes every 5 seconds when stable
-
Switch between normal OCR mode and dedicated QR stream mode