A Python-based OCR system that uses OpenCV and Pytesseract to detect and extract credit card numbers and cardholder information from credit card images.
This repository contains a complete implementation of an optical character recognition (OCR) pipeline specifically designed for credit card text extraction. The system processes credit card images to identify and extract:
- Credit card numbers
- Cardholder names
- Other relevant text information
- OpenCV-based image preprocessing
- Pytesseract OCR integration
- Jupyter notebook with step-by-step implementation
- Comprehensive image dataset for testing
- Custom utility functions for image processing
- Python 3.6+
- OpenCV
- Pytesseract
- Jupyter Notebook
- Required Python packages (see notebook for full list)
- Clone the repository:
git clone <repository-url>
cd CreditCard_Optical_Character_Recognition- Install required dependencies:
pip install opencv-python pytesseract jupyter numpy pandas matplotlib seaborn scikit-learn torch torchvision- Jupyter Notebook: Open
notebooks/Credit_Card_Reader_Implementation.ipynband follow the step-by-step instructions - Image Dataset: Explore the sample images in the
/imagesfolder - Custom Implementation: Use the utility functions in
scripts/utils2.pyfor your own implementations
To run this project using Docker:
- Build the Docker image:
docker build -t credit-card-ocr .- Run the container:
docker run -it --rm -p 8888:8888 -v $(pwd):/workspace credit-card-ocr- Access Jupyter Notebook:
- Open your browser and navigate to
http://localhost:8888 - Use the token provided in the terminal output
- Open your browser and navigate to
CreditCard_Optical_Character_Recognition/
├── images/ # Sample credit card images
├── notebooks/ # Jupyter notebook implementation
├── scripts/ # Utility functions
├── README.md # This file
├── objectives.md # Project objectives and goals
└── .gitignore # Git ignore file
- Implementation Blog Post - Detailed implementation walkthrough
- Project Objectives - Project goals and objectives
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is open source and available under the MIT License.


