Skip to content

omarabdiwali/qr-code-decoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QR Code Reader & Decoder

Overview

A Python-based QR code processing system that analyzes images, detects structural patterns, and decodes contained data. Generates visual annotations while supporting numeric, alphanumeric, kanji, and binary data extraction.

The following images are based on this QR code, which has the text 'hello world' embedded within it:

Test QR Code

Features

  • Pattern Detection

    • Automatically identifies finder patterns (corners), timing patterns (alignment lines), and version/format information.
  • Visual Debugging - Generates layered SVG outputs showing:

    • Original QR code
    • Timing patterns (gold)
    • Decoding path (color-coded)
    • Format/version info areas

    Visualization

  • Data Decoding - Supports:

    • Numeric, alphanumeric, kanji, and 8-bit byte encoding
    • Error correction levels (L, M, Q, H)
    • Versions 1-40 (auto-detected)
    • Mask pattern reversal
    • This is the unmasked QR data and error correction bits:

    Unmasking

  • Intelligent Processing

    • Dynamically calculates block sizes and handles orientation variations.
    • Rotates the image based on the finder pattern positions

Requirements

  • Python 3.8+

  • Pillow library:

    pip install Pillow

Usage

  1. Basic Processing

    python main.py --input qr_image.png --output analysis.svg
  2. Output Interpretation

    • Open the resulting SVG in any modern browser
    • Gold rectangles = Timing patterns
    • Purple/Green rectangles = Format info
    • Orange rectangles = Alignment patterns
    • Colored blocks = Data decoding sequence

Sample Workflow

graph LR
A[Input Image] --> B[Pattern Detection]
B --> C[SVG Visualization]
B --> D[Grid Creation]
D --> E[Format Decoding]
E --> F[Data Extraction]
F --> G[Decoded Output]
Loading

Supported QR Specifications

Feature Support Level
Encoding Modes Numeric, Alphanumeric, Byte, Kanji
Error Correction L (7%), M (15%), Q (25%), H (30%)
Version Detection 1-40 (Auto-scaled)
Mask Patterns 8 standard types

Limitations

  • Static image input only (no camera support)
  • Currently does not include any error handling

Development Notes

.
├── main.py            # Entry point & visualization pipeline
├── parse.py           # Core detection/decoding logic
└── xmlpy.py           # SVG generation utilities

License

Open-source under MIT License. Commercial use permitted with attribution.

About

A QR Code decoder complete with a visualization, created using Python.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages