Skip to main content

Capstone: Pokemon Card Border Detection

Automated Pokemon Card Border Detection using Computer Vision


Real-World Problem Statement

Pokemon card collectors, grading services, and digital archiving platforms face a common challenge: accurately detecting card boundaries in images taken under varying conditions. Cards may be photographed at angles, in protective sleeves/holders, with different backgrounds, or under inconsistent lighting.

Manual identification of card borders is:

  • Time-consuming for large collections
  • Error-prone and inconsistent
  • Not scalable for commercial grading services

This project builds an automated Pokemon card border detection system that:

  1. Locates the outer border (physical card edges)
  2. Identifies the inner border (where artwork/content begins)
  3. Performs perspective correction to flatten angled cards
  4. Returns precise corner coordinates for downstream applications (centering analysis, grading automation, digital archiving)

Target Users

  • Card grading companies automating quality assessment
  • Collectors digitizing and cataloging their collections
  • Marketplaces needing standardized card images
  • Researchers studying card condition/authenticity

Project Scope

In Scope (What You Will Build)

  • Image preprocessing pipeline for card images
  • Card localization within an image
  • Outer border (physical edge) detection
  • Inner border (artwork boundary) detection
  • Perspective correction for angled cards
  • Coordinate transformation tracking
  • Web UI for uploading images and viewing detection results (main interface)

Out of Scope (Not Required)

  • Training custom ML models (use pre-trained models)
  • Card grading score calculation
  • Multi-card detection in single image
  • Video processing / real-time detection
  • Cloud deployment (local Docker is sufficient)
  • Database integration for results storage

Expected Time to Complete

Total Duration: 10-14 days (~1.5-2 weeks)

PhaseDurationActivities
Phase 1: Research & Setup2-3 daysEnvironment setup, research approaches, understand the problem
Phase 2: Card Localization3-4 daysImplement card detection and isolation from background
Phase 3: Border Detection3-4 daysDetect outer and inner borders, calculate corners
Phase 4: UI & Integration2-3 daysBuild web UI, testing, documentation
Total10-14 days~1.5-2 weeks

Prerequisites

Required Knowledge

  • Python programming (intermediate level)
  • Familiarity with NumPy arrays
  • Basic linear algebra (matrices, transformations)
  • OpenCV experience
  • Deep learning concepts
  • Docker basics
  • Web UI basics (HTML, CSS, or Python web frameworks like Streamlit/Gradio)
  • Git version control basics

Hardware Requirements

  • GPU Recommended: NVIDIA GPU with 8GB+ VRAM
  • CPU Fallback: Possible but significantly slower
  • RAM: 16GB minimum
  • Storage: ~5GB for models

Deliverables

Important: Your code must be tracked on GitHub throughout the project. Commit frequently with meaningful messages from day one. Your commit history will be reviewed as part of the evaluation - it demonstrates your development process and professional practices.

1. Working Codebase

A well-organized Python project that:

  • Accepts Pokemon card images as input
  • Detects outer and inner border corners
  • Returns perspective-corrected card image
  • Web UI for image upload and result visualization (main interface)
  • Runs in Docker container
  • Hosted on GitHub with clear commit history

2. README Documentation

Must include:

  • Project overview and problem statement
  • Installation instructions (local + Docker)
  • API usage examples with curl/Python
  • Configuration options explained
  • Architecture diagram showing your approach
  • Sample input/output images

3. Short Write-Up (1-2 pages)

Document your learning journey:

  • Technical Decisions: Why you chose specific approaches
  • Challenges Faced: Problems encountered and how you solved them
  • Key Learnings: New concepts/techniques you mastered
  • Future Improvements: What you would add with more time

4. Demo Materials

  • 10+ test images with detection results

Evaluation Rubric

Sufficient (Pass)

CriteriaRequirements
FunctionalityDetects outer borders on clean, front-facing card images
Web UIUpload image and view detected corners
Code QualityCode runs without errors, basic organization
DocumentationREADME with installation and basic usage
TestingWorks on 3+ provided test images

Good (Competent)

CriteriaRequirements
FunctionalityDetects both outer AND inner borders; handles slight angles
Web UIClear visualization of borders, displays perspective-corrected image
Code QualityModular design, configuration via environment variables
DocumentationComprehensive README with architecture explanation
TestingWorks on 5+ images including some challenging cases
ExtrasClean REST API exposing detection functionality

Excellent (Exceptional)

CriteriaRequirements
FunctionalityRobust detection across varied conditions (angles, holders, lighting)
Web UIPolished interface with error handling and loading states
Code QualityClean architecture, type hints, error handling, logging
DocumentationFull docs with diagrams, usage examples, troubleshooting guide
TestingComprehensive test suite; works on 10+ diverse images
ExtrasDocker deployment, REST API with health checks, performance metrics
InnovationNovel improvements or additional features beyond requirements

Checkpoint Milestones

Use these checkpoints to track your progress:

Checkpoint 1 (Day 3)

  • Development environment set up
  • Research complete - chosen approach documented
  • Can load and display images programmatically
  • Basic card detection prototype working

Checkpoint 2 (Day 6)

  • Card can be isolated from background
  • Edge detection producing usable results
  • Initial border lines detected

Checkpoint 3 (Day 10)

  • Outer corners calculated accurately
  • Perspective correction working
  • Inner border detection implemented
  • Coordinates map back to original image

Checkpoint 4 (Day 14)

  • Web UI allows image upload and displays results
  • Detection results visualized clearly in browser
  • Docker container builds and runs
  • README and write-up complete
  • Demo materials prepared

Research Starting Points

You'll need to research and decide on approaches for:

  1. Card Localization: How to find the card in an image?

    • Consider: object detection models, color-based segmentation, edge detection
  2. Border Detection: How to find precise border lines?

    • Consider: classical CV techniques, line detection algorithms, contour analysis
  3. Perspective Correction: How to flatten an angled card?

    • Consider: geometric transformations, homography
  4. Coordinate Systems: How to track points through transformations?

    • Consider: transformation matrices, inverse mappings
  5. Web UI: How to build an interface for image upload and result display?

    • Consider: Python web frameworks, file upload handling, image rendering

Useful Resources

  • OpenCV documentation and tutorials
  • Research papers on document/card detection
  • Pre-trained object detection and segmentation models
  • Python web framework documentation (Flask, Streamlit, Gradio, etc.)

Tips for Success

  1. Start Simple: Get basic detection working on clean images first, then handle edge cases

  2. Visualize Everything: Draw detected features on images to debug your pipeline

  3. Track Coordinates Carefully: Mapping coordinates through transformations is challenging - document each step

  4. Test Incrementally: Verify each stage works before moving to the next

  5. Handle Failures Gracefully: Not every image will work - return meaningful error messages

  6. Keep Configuration Flexible: Use environment variables so you can tune parameters without code changes


Test Image Scenarios

Download Test Images Dataset

Your system should handle:

  • Clean front-facing card on solid background
  • Card at slight angle (< 15 degrees)
  • Card in clear plastic sleeve
  • Card with busy/textured background
  • Cards with different border colors (yellow, silver, gold, etc.)

Extension Ideas (Optional)

If you finish early or want extra challenge:

  1. Batch Processing: Handle multiple images in one request
  2. Centering Score: Calculate how centered the artwork is within borders
  3. Confidence Scores: Return detection confidence metrics
  4. Visualization API: Return annotated image with borders drawn
  5. Performance Optimization: Implement async processing for faster response

Good luck! This project combines computer vision techniques with practical web development - skills highly valued in the industry.