Skip to content

DarkS34/image-corner-detector

Repository files navigation

Document Scanner Project

This repository implements a document scanner in Python as part of the "Artificial Vision" course at URJC. The application takes a photo of a paper document and outputs a rectified (top-down) view of the paper, mimicking the result of a traditional scanner.

Features

  • Detects the four corner points of a paper document using Harris keypoints and SIFT descriptors.
  • Applies image thresholding and morphological operations to clean up the image.
  • Matches keypoints against a reference set to localize corners.
  • Performs a perspective transform to generate a scanned version of the document.
  • Includes a test mode that batch-processes a folder of images and displays results interactively.

Technologies Used

  • Python 3.12
  • OpenCV 4.11
  • NumPy
  • SciPy
  • Matplotlib
  • Pandas

How to Use

Single Image Mode

python scanner.py path/to/image.jpg

Batch Mode (Test Folder)

python scanner.py --test path/to/test_folder

Reference Data

The system expects a CSV file with manually labeled corner points and a folder with the corresponding reference images:

  • learning_corner_points.csv
  • muestraTrainTest/learning/

These are used to compute reference descriptors used in corner detection.

Output

  • Transformed (rectified) document image.
  • In test mode, displays side-by-side visualization of preprocessing and corner detection.

Project Structure

scanner.py                # Main program
learning_corner_points.csv # CSV with labeled corner points
muestraTrainTest/          # Contains training and test images

Requirements

Install the required packages with:

pip install -r requirements.txt

Notes

  • Corner detection may fail if document edges are not clearly visible or poorly illuminated.

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages