A Python library for detecting and extracting data from Cambodian National ID cards.
Project description
Khmer NID Detector
A Python package for detecting and extracting information from Khmer National ID cards using OCR and computer vision.
Features
- 🔍 Card Type Detection: Automatically detects various types of cards and documents
- 🇰🇭 Khmer NID Optimized: Specifically designed for Cambodian National ID cards
- 📄 Information Extraction: Extracts NID number, name, and date of birth
- 🖼️ Image Preprocessing: Enhances image quality for better OCR accuracy
- 🚀 Easy to Use: Simple API with clear documentation
Supported Card Types
nid_card- Khmer National ID cardcredit_card- Credit carddebit_card- Debit carddriver_license- Driver's licensebusiness_card- Business cardother_document- Other document typesnot_a_card- Not a card or document
Installation
pip install khmer-nid-detector
example to use
# from khmer_nid_detector import detect_card_type, process_nid_card
from khmer_nid_detector import detect_card_type, process_nid_card
# Read image as bytes
with open("nid_card.jpg", "rb") as f:
image_bytes = f.read()
# Detect card type
card_type = detect_card_type(image_bytes)
print(f"Detected card type: {card_type}")
# If it's an NID card, process it
if card_type == "nid_card":
result = process_nid_card(image_bytes)
if result["success"]:
print(f"NID Number: {result['nid_number']}")
print(f"Name: {result['name']}")
print(f"Date of Birth: {result['dob']}")
print(f"Is Khmer NID: {result['is_khmer_nid']}")
print(f"Message: {result['message']}")
else:
print(f"Error: {result['message']}")
example Structure Code
.
├── IMG_20251005_154748.png
├── nid_card.jpg
├── nid_env
│ ├── bin
│ ├── include
│ ├── lib
│ ├── pyvenv.cfg
│ └── share
└── v1.py
Example to run Code
python3 v1.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file khmer_nid_detector-0.1.3-py3-none-any.whl.
File metadata
- Download URL: khmer_nid_detector-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94bddf52645f827998896db757e3dfedccaa41b3b8b577ef80778fb0d0d646f5
|
|
| MD5 |
0d87dce3ee7ba492235dbfd3bc3ead24
|
|
| BLAKE2b-256 |
6df60df67fc72bd86b9554e3dcf3521a57a44eae5b297d9790bd2ef02235dd0f
|