Bank Card Scanning and Recognition Project Overview
This article describes a mobile payment‑focused bank card OCR project that extends an open‑source solution to support Chinese 19‑digit debit cards by introducing new algorithms for vertical coordinate detection, background filtering, single‑character recognition, and Luhn‑based checksum validation.
Background: Image recognition is a key area of artificial intelligence, evolving from character recognition to object detection. With the rise of mobile payments, manually entering bank card numbers is slow and error‑prone, prompting companies like PayPal, Apple, Alibaba, and Tencent to develop card‑number recognition solutions.
General Credit Card Recognition Process:
Project Introduction: Building on an open‑source OCR framework, this project adds support for Chinese local debit cards, aiming to recognize 19‑digit cards (including embossed and flat cards with complex backgrounds) with accuracy comparable to Alipay.
Project Achievements: The original solution only handled 15‑ and 16‑digit credit cards and struggled with light or complex backgrounds. By extending the framework, support for 19‑digit cards was added, resolving many previous recognition failures.
Main Challenges Addressed:
1. Vertical coordinate detection for black‑printed cards: Traditional methods failed on black printed fonts; a stronger algorithm based on the Kitty thresholding technique was employed to compute per‑row edge scores, identifying continuous high‑score rows as the card number region.
2. Vertical coordinate detection for light‑colored embossed cards: Using the Prewitt operator and custom optimizations, the system reliably detects foreground characters against light backgrounds.
Specific Workflow:
3. Background filtering for black‑printed fonts: Combining Laplace operators with adaptive binarization, a new algorithm separates foreground text from complex backgrounds where a single threshold does not exist.
4. Single‑character recognition for black‑printed fonts: Since Card.IO lacks printed‑font character recognition, a lightweight method combining feature extraction (horizontal and vertical projections) with template matching was developed to handle the two typical Chinese card fonts.
Example: The digit “0” may have horizontal projection values 4,4,6,4 and vertical projection values 2,3,4,3,4,4; matching these features with templates identifies the character.
5. Bank card number verification: Because recognition is not 100 % reliable, detected numbers are validated using the Luhn algorithm adapted for 19‑digit Chinese cards (the 19th digit is a checksum). The verification steps are: (1) multiply all even‑position digits by 2; (2) for results >9, sum the tens and units digits; (3) sum all digits and multiply by 9; (4) the unit digit of the result is the checksum.
For recruitment information, click “Read Original” to view more details from Ctrip Tech.
Ctrip Technology
Official Ctrip Technology account, sharing and discussing growth.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.