UNPKG

ngx-image-id-detector

Version:

A package that detects if an image is a Vietnamese citizen ID using Tesseract.js

68 lines (44 loc) โ€ข 1.58 kB
# ๐Ÿ“ท ngx-image-id-detector **ngx-image-id-detector** is an Angular library for detecting whether an image is a Vietnamese Citizen ID card (CCCD) using OCR (`Tesseract.js`). It can distinguish between the front side, back side, or unrecognized images. ## โœจ Features * โœ… Detects the **front** side of CCCD * โœ… Detects the **back** side of CCCD * โŒ Distinguishes invalid images (blurred, glare, cropped, not CCCD) * ๐Ÿ”  Supports Vietnamese language with Tesseract.js (`lang: vie`) * ๐Ÿ” Returns results as Observable, suitable for Angular --- ## ๐Ÿ“ฆ Installation ```bash npm install ngx-image-id-detector tesseract.js ``` --- ## ๐Ÿ“‹ Version Compatibility | ngx-image-id-detector | Angular version | Tesseract.js version | | --------------------- | --------------- | -------------------- | | 1.x | 16+ | 4.x | | 0.x | 13โ€“15 | 2.x | --- ## ๐Ÿงช Example Demo source is available in the `example/` folder: ```ts import { DetectIdService } from 'ngx-image-id-detector'; constructor(private detectIdService: DetectIdService) {} onImageSelected(file: File) { this.detectIdService.detect(file).subscribe(result => { console.log(result); }); } ``` ## โœ… Result Structure ```ts interface DetectIdResult { side: 'front' | 'back' | 'unknown'; text: string; } ``` --- ## ๐ŸŒ GitHub Repository ๐Ÿ‘‰ [https://github.com/nguyentrunghieutcu/ngx-image-id-detector](https://github.com/nguyentrunghieutcu/ngx-image-id-detector) --- ## ๐Ÿ“„ License [MIT](LICENSE)